annotate app/views/time_entry_reports/report.rhtml @ 904:0a8317a50fa0 redmine-1.1

Close obsolete branch redmine-1.1
author Chris Cannam
date Fri, 14 Jan 2011 12:53:21 +0000
parents 94944d00e43c
children cbce1fd3b1b7
rev   line source
chris@37 1 <div class="contextual">
chris@37 2 <%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'new', :project_id => @project, :issue_id => @issue}, :class => 'icon icon-time-add' %>
chris@37 3 </div>
chris@37 4
chris@37 5 <%= render_timelog_breadcrumb %>
chris@37 6
chris@37 7 <h2><%= l(:label_spent_time) %></h2>
chris@37 8
chris@37 9 <% form_remote_tag(:url => {}, :html => {:method => :get, :id => 'query_form'}, :method => :get, :update => 'content') do %>
chris@37 10 <% @criterias.each do |criteria| %>
chris@37 11 <%= hidden_field_tag 'criterias[]', criteria, :id => nil %>
chris@37 12 <% end %>
chris@37 13 <%# TODO: get rid of the project_id field, that should already be in the URL %>
chris@37 14 <%= hidden_field_tag('project_id', params[:project_id]) if @project %>
chris@37 15 <%= hidden_field_tag('issue_id', params[:issue_id]) if @issue %>
chris@37 16 <%= render :partial => 'timelog/date_range' %>
chris@37 17
chris@37 18 <p><%= l(:label_details) %>: <%= select_tag 'columns', options_for_select([[l(:label_year), 'year'],
chris@37 19 [l(:label_month), 'month'],
chris@37 20 [l(:label_week), 'week'],
chris@37 21 [l(:label_day_plural).titleize, 'day']], @columns),
chris@37 22 :onchange => "this.form.onsubmit();" %>
chris@37 23
chris@37 24 <%= l(:button_add) %>: <%= select_tag('criterias[]', options_for_select([[]] + (@available_criterias.keys - @criterias).collect{|k| [l_or_humanize(@available_criterias[k][:label]), k]}),
chris@37 25 :onchange => "this.form.onsubmit();",
chris@37 26 :style => 'width: 200px',
chris@37 27 :id => nil,
chris@37 28 :disabled => (@criterias.length >= 3)) %>
chris@37 29 <%= link_to_remote l(:button_clear), {:url => {:project_id => @project, :period_type => params[:period_type], :period => params[:period], :from => @from, :to => @to, :columns => @columns},
chris@37 30 :method => :get,
chris@37 31 :update => 'content'
chris@37 32 }, :class => 'icon icon-reload' %></p>
chris@37 33 <% end %>
chris@37 34
chris@37 35 <% unless @criterias.empty? %>
chris@37 36 <div class="total-hours">
chris@37 37 <p><%= l(:label_total) %>: <%= html_hours(l_hours(@total_hours)) %></p>
chris@37 38 </div>
chris@37 39
chris@37 40 <% unless @hours.empty? %>
chris@37 41 <table class="list" id="time-report">
chris@37 42 <thead>
chris@37 43 <tr>
chris@37 44 <% @criterias.each do |criteria| %>
chris@37 45 <th><%= l_or_humanize(@available_criterias[criteria][:label]) %></th>
chris@37 46 <% end %>
chris@37 47 <% columns_width = (40 / (@periods.length+1)).to_i %>
chris@37 48 <% @periods.each do |period| %>
chris@37 49 <th class="period" width="<%= columns_width %>%"><%= period %></th>
chris@37 50 <% end %>
chris@37 51 <th class="total" width="<%= columns_width %>%"><%= l(:label_total) %></th>
chris@37 52 </tr>
chris@37 53 </thead>
chris@37 54 <tbody>
chris@37 55 <%= render :partial => 'report_criteria', :locals => {:criterias => @criterias, :hours => @hours, :level => 0} %>
chris@37 56 <tr class="total">
chris@37 57 <td><%= l(:label_total) %></td>
chris@37 58 <%= '<td></td>' * (@criterias.size - 1) %>
chris@37 59 <% total = 0 -%>
chris@37 60 <% @periods.each do |period| -%>
chris@37 61 <% sum = sum_hours(select_hours(@hours, @columns, period.to_s)); total += sum -%>
chris@37 62 <td class="hours"><%= html_hours("%.2f" % sum) if sum > 0 %></td>
chris@37 63 <% end -%>
chris@37 64 <td class="hours"><%= html_hours("%.2f" % total) if total > 0 %></td>
chris@37 65 </tr>
chris@37 66 </tbody>
chris@37 67 </table>
chris@37 68
chris@37 69 <% other_formats_links do |f| %>
chris@37 70 <%= f.link_to 'CSV', :url => params %>
chris@37 71 <% end %>
chris@37 72 <% end %>
chris@37 73 <% end %>
chris@37 74
chris@37 75 <% html_title l(:label_spent_time), l(:label_report) %>
chris@37 76