Files
redmine_contracts/app/views/deliverables/_finances.html.erb

196 lines
7.3 KiB
Plaintext

<div id="summary" class="contextual">
<%= l(:text_deliverable_spending_summary,
:spent => content_tag(:span, h(number_to_currency(deliverable.labor_budget_spent, :precision => 0)), :class => 'spent'),
:total => content_tag(:span, h(number_to_currency(deliverable.labor_budget_total, :precision => 0)), :class => 'total'),
:hours => content_tag(:span, h(deliverable.labor_hours_spent_total), :class => 'hours')) %>
</div>
<h2><%= h(deliverable.title) %></h2>
<div id="deliverable-activities" style="width: 33%">
<h3>Activities</h3>
<table id="deliverable-labor-activities" class="striped-contract-style">
<thead>
<th><%= l(:field_labor) %></th>
<th colspan="2"><%= l(:field_cost) %></th>
<th colspan="2"><%= l(:field_hours) %></th>
</thead>
<tbody>
<%# Each labor activity + non-budgeted activities %>
<% deliverable.billable_time_entry_activities.each do |activity| %>
<% content_tag_for(:tr, activity, :class => 'labor ' + cycle('even','')) do %>
<td class="labor">
<%= h(activity.name) %>
</td>
<td class="spent-amount labor <%= overage_class(deliverable.spent_for_activity(activity), deliverable.budget_for_activity(activity)) %>">
<%= number_to_currency(deliverable.spent_for_activity(activity), :precision => 0) %>
</td>
<td class="total-amount labor">
<%= number_to_currency(deliverable.budget_for_activity(activity), :precision => 0) %>
</td>
<td class="spent-hours labor <%= overage_class(deliverable.hours_spent_for_activity(activity), deliverable.hours_budget_for_activity(activity)) %>">
<%= number_with_precision(deliverable.hours_spent_for_activity(activity), :precision => 0) %>
</td>
<td class="total-deliverable-hours labor">
<%= number_with_precision(deliverable.hours_budget_for_activity(activity), :precision => 0) %>
</td>
<% end %>
<% end %>
<tr class="total summary-row labor">
<td class="labor">
Totals
</td>
<td class="spent-amount labor <%= overage_class(deliverable.labor_budget_spent, deliverable.labor_budget_total) %>">
<%= number_to_currency(deliverable.labor_budget_spent, :precision => 0) %>
</td>
<td class="total-amount labor">
<%= number_to_currency(deliverable.labor_budget_total, :precision => 0) %>
</td>
<td class="spent-hours labor <%= overage_class(deliverable.labor_hours_spent_total, deliverable.labor_budget_hours) %>">
<%= number_with_precision(deliverable.labor_hours_spent_total, :precision => 0) %>
</td>
<td class="total-deliverable-hours labor">
<%= number_with_precision(deliverable.labor_budget_hours, :precision => 0) %>
</td>
</tr>
</tbody>
</table>
<table id="deliverable-overhead-activities" class="striped-contract-style">
<thead>
<th><%= l(:field_overhead) %></th>
<th colspan="2"><%= l(:field_cost) %></th>
<th colspan="2"><%= l(:field_hours) %></th>
</thead>
<tbody>
<% deliverable.non_billable_time_entry_activities.each do |activity| %>
<% content_tag_for(:tr, activity, :class => 'overhead ' + cycle('even','')) do %>
<td class="overhead">
<%= h(activity.name) %>
</td>
<td class="spent-amount overhead <%= overage_class(deliverable.spent_for_activity(activity), deliverable.budget_for_activity(activity)) %>">
<%= number_to_currency(deliverable.spent_for_activity(activity), :precision => 0) %>
</td>
<td class="total-amount overhead">
<%= number_to_currency(deliverable.budget_for_activity(activity), :precision => 0) %>
</td>
<td class="spent-hours overhead <%= overage_class(deliverable.hours_spent_for_activity(activity), deliverable.hours_budget_for_activity(activity)) %>">
<%= number_with_precision(deliverable.hours_spent_for_activity(activity), :precision => 0) %>
</td>
<td class="total-deliverable-hours overhead">
<%= number_with_precision(deliverable.hours_budget_for_activity(activity), :precision => 0) %>
</td>
<% end %>
<% end %>
<tr class="total summary-row overhead">
<td class="overhead">
Totals
</td>
<td class="spent-amount overhead <%= overage_class(deliverable.overhead_spent, deliverable.overhead_budget_total) %>">
<%= number_to_currency(deliverable.overhead_spent, :precision => 0) %>
</td>
<td class="total-amount overhead">
<%= number_to_currency(deliverable.overhead_budget_total, :precision => 0) %>
</td>
<td class="spent-hours overhead <%= overage_class(deliverable.overhead_hours_spent_total, deliverable.overhead_budget_hours) %>">
<%= number_with_precision(deliverable.overhead_hours_spent_total, :precision => 0) %>
</td>
<td class="total-deliverable-hours overhead">
<%= number_with_precision(deliverable.overhead_budget_hours, :precision => 0) %>
</td>
</tr>
</tbody>
</table>
</div><%# /div#activities %>
<div id="deliverable-users" style="width: 33%">
<h3>Users</h3>
<table id="deliverable-labor-users" class="striped-contract-style">
<thead>
<th><%= l(:field_labor) %></th>
<th><%= l(:field_cost) %></th>
<th><%= l(:field_hours) %></th>
</thead>
<tbody>
<% deliverable.users_with_billable_time.sort.each do |user| %>
<% content_tag_for(:tr, user, :class => 'labor ' + cycle('even','')) do %>
<td class="labor">
<%= h(user.name) %>
</td>
<td class="amount-cost labor">
<%= number_to_currency(deliverable.spent_for_user(user, true), :precision => 0) %>
</td>
<td class="time-cost labor">
<%= number_with_precision(deliverable.hours_spent_for_user(user, true), :precision => 0) %>
</td>
<% end %>
<% end %>
<tr class="total summary-row labor">
<td class="labor">
Totals
</td>
<td class="amount-cost labor">
<%= number_to_currency(deliverable.labor_budget_spent, :precision => 0) %>
</td>
<td class="time-cost labor">
<%= number_with_precision(deliverable.labor_hours_spent_total, :precision => 0) %>
</td>
</tr>
</tbody>
</table>
<table id="deliverable-overhead-users" class="striped-contract-style">
<thead>
<th><%= l(:field_overhead) %></th>
<th><%= l(:field_cost) %></th>
<th><%= l(:field_hours) %></th>
</thead>
<tbody>
<% deliverable.users_with_non_billable_time.sort.each do |user| %>
<% content_tag_for(:tr, user, :class => 'overhead ' + cycle('even','')) do %>
<td class="overhead">
<%= h(user.name) %>
</td>
<td class="amount-cost overhead">
<%= number_to_currency(deliverable.spent_for_user(user, false), :precision => 0) %>
</td>
<td class="time-cost overhead">
<%= number_with_precision(deliverable.hours_spent_for_user(user, false), :precision => 0) %>
</td>
<% end %>
<% end %>
<tr class="total summary-row overhead">
<td class="overhead">
Totals
</td>
<td class="amount-cost overhead">
<%= number_to_currency(deliverable.overhead_spent, :precision => 0) %>
</td>
<td class="time-cost overhead">
<%= number_with_precision(deliverable.overhead_hours_spent_total, :precision => 0) %>
</td>
</tr>
</tbody>
</table>
</div><%# /div.users %>