Files
redmine_contracts/app/views/deliverables/_finances.html.erb
2011-11-14 11:10:55 -08:00

307 lines
12 KiB
Plaintext

<div id="finance-summary" class="contextual">
<%= l(:text_deliverable_spending_summary,
:spent => content_tag(:span, h(number_to_currency(deliverable.labor_budget_spent, :precision => Deliverable::ViewPrecision)), :class => 'spent'),
:total => content_tag(:span, h(number_to_currency(deliverable.labor_budget_total, :precision => Deliverable::ViewPrecision)), :class => 'total'),
:hours => content_tag(:span, h(number_with_precision(deliverable.labor_hours_spent_total, :precision => Deliverable::ViewPrecision)), :class => 'hours')) %>
</div>
<h2><%= h(deliverable.title) %></h2>
<% has_categories = deliverable.project.issue_categories.count > 0 %>
<div id="deliverable-activities" class="deliverable-finance-report" style=" width: 48%">
<h3>Activities</h3>
<table id="deliverable-labor-activities" class="striped-contract-style">
<thead>
<th><%= l(:field_labor) %></th>
<th colspan="2"><%= l(:field_spent_estimate) %></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="">
<%= h(activity.name) %>
</td>
<td class="financial spent-amount <%= overage_class(deliverable.spent_for_activity(activity), deliverable.budget_for_activity(activity)) %>">
<%= number_to_currency(deliverable.spent_for_activity(activity), :precision => Deliverable::ViewPrecision) %>
</td>
<td class="financial total-amount">
<%= number_to_currency(deliverable.budget_for_activity(activity), :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric spent-hours <%= overage_class(deliverable.hours_spent_for_activity(activity), deliverable.hours_budget_for_activity(activity)) %>">
<%= number_with_precision(deliverable.hours_spent_for_activity(activity), :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric total-deliverable-hours">
<%= number_with_precision(deliverable.hours_budget_for_activity(activity), :precision => Deliverable::ViewPrecision) %>
</td>
<% end %>
<% end %>
<tr class="total summary-row labor">
<td class="">
Totals
</td>
<td class="financial spent-amount <%= overage_class(deliverable.labor_budget_spent, deliverable.labor_budget_total) %>">
<%= number_to_currency(deliverable.labor_budget_spent, :precision => Deliverable::ViewPrecision) %>
</td>
<td class="financial total-amount">
<%= number_to_currency(deliverable.labor_budget_total, :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric spent-hours <%= overage_class(deliverable.labor_hours_spent_total, deliverable.labor_budget_hours) %>">
<%= number_with_precision(deliverable.labor_hours_spent_total, :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric total-deliverable-hours">
<%= number_with_precision(deliverable.labor_budget_hours, :precision => Deliverable::ViewPrecision) %>
</td>
</tr>
</tbody>
</table>
<table id="deliverable-overhead-activities" class="striped-contract-style">
<thead>
<th><%= l(:field_overhead) %></th>
<th colspan="2"><%= l(:field_spent_estimate) %></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="">
<%= h(activity.name) %>
</td>
<td class="financial spent-amount <%= overage_class(deliverable.spent_for_activity(activity), deliverable.budget_for_activity(activity)) %>">
<%= number_to_currency(deliverable.spent_for_activity(activity), :precision => Deliverable::ViewPrecision) %>
</td>
<td class="financial total-amount">
<%= number_to_currency(deliverable.budget_for_activity(activity), :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric spent-hours <%= overage_class(deliverable.hours_spent_for_activity(activity), deliverable.hours_budget_for_activity(activity)) %>">
<%= number_with_precision(deliverable.hours_spent_for_activity(activity), :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric total-deliverable-hours">
<%= number_with_precision(deliverable.hours_budget_for_activity(activity), :precision => Deliverable::ViewPrecision) %>
</td>
<% end %>
<% end %>
<tr class="total summary-row overhead">
<td class="">
Totals
</td>
<td class="financial spent-amount <%= overage_class(deliverable.overhead_spent, deliverable.overhead_budget_total) %>">
<%= number_to_currency(deliverable.overhead_spent, :precision => Deliverable::ViewPrecision) %>
</td>
<td class="financial total-amount">
<%= number_to_currency(deliverable.overhead_budget_total, :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric spent-hours <%= overage_class(deliverable.overhead_hours_spent_total, deliverable.overhead_budget_hours) %>">
<%= number_with_precision(deliverable.overhead_hours_spent_total, :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric total-deliverable-hours">
<%= number_with_precision(deliverable.overhead_budget_hours, :precision => Deliverable::ViewPrecision) %>
</td>
</tr>
</tbody>
</table>
</div><%# /div#activities %>
<div id="deliverable-users" class="deliverable-finance-report" style=" width: 48%" >
<h3>Users</h3>
<table id="deliverable-labor-users" class="striped-contract-style">
<thead>
<th><%= l(:field_labor) %></th>
<th><%= l(:field_spent) %></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="">
<%= h(user.name) %>
</td>
<td class="financial amount-cost">
<%= number_to_currency(deliverable.spent_for_user(user, true), :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric time-cost">
<%= number_with_precision(deliverable.hours_spent_for_user(user, true), :precision => Deliverable::ViewPrecision) %>
</td>
<% end %>
<% end %>
<tr class="total summary-row labor">
<td class="">
Totals
</td>
<td class="financial amount-cost">
<%= number_to_currency(deliverable.labor_budget_spent, :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric time-cost">
<%= number_with_precision(deliverable.labor_hours_spent_total, :precision => Deliverable::ViewPrecision) %>
</td>
</tr>
</tbody>
</table>
<table id="deliverable-overhead-users" class="striped-contract-style">
<thead>
<th><%= l(:field_overhead) %></th>
<th><%= l(:field_spent) %></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="">
<%= h(user.name) %>
</td>
<td class="financial amount-cost">
<%= number_to_currency(deliverable.spent_for_user(user, false), :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric time-cost">
<%= number_with_precision(deliverable.hours_spent_for_user(user, false), :precision => Deliverable::ViewPrecision) %>
</td>
<% end %>
<% end %>
<tr class="total summary-row overhead">
<td class="">
Totals
</td>
<td class="financial amount-cost">
<%= number_to_currency(deliverable.overhead_spent, :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric time-cost">
<%= number_with_precision(deliverable.overhead_hours_spent_total, :precision => Deliverable::ViewPrecision) %>
</td>
</tr>
</tbody>
</table>
</div><%# /div.users %>
<% if has_categories %>
<div id="deliverable-issue-categories" class="deliverable-finance-report" style=" width: 48%" >
<h3>Issue Categories</h3>
<table id="deliverable-labor-issue-categories" class="striped-contract-style">
<thead>
<th><%= l(:field_labor) %></th>
<th><%= l(:field_spent) %></th>
<th><%= l(:field_hours) %></th>
</thead>
<tbody>
<% deliverable.issue_categories_with_billable_time.sort.each do |category| %>
<% content_tag_for(:tr, category, :class => 'labor ' + cycle('even','')) do %>
<td class="">
<%= h(category.name) %>
</td>
<td class="financial amount-cost">
<%= number_to_currency(deliverable.spent_for_issue_category(category, true), :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric time-cost">
<%= number_with_precision(deliverable.hours_spent_for_issue_category(category, true), :precision => Deliverable::ViewPrecision) %>
</td>
<% end %>
<% end %>
<% content_tag_for(:tr, IssueCategory.new, :class => 'labor ' + cycle('even','')) do %>
<td class="">
<%= l(:label_none) %>
</td>
<td class="financial amount-cost">
<%= number_to_currency(deliverable.spent_for_issue_category(nil, true), :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric time-cost">
<%= number_with_precision(deliverable.hours_spent_for_issue_category(nil, true), :precision => Deliverable::ViewPrecision) %>
</td>
<% end %>
<tr class="total summary-row labor">
<td class="">
Totals
</td>
<td class="financial amount-cost">
<%= number_to_currency(deliverable.labor_budget_spent, :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric time-cost">
<%= number_with_precision(deliverable.labor_hours_spent_total, :precision => Deliverable::ViewPrecision) %>
</td>
</tr>
</tbody>
</table>
<table id="deliverable-overhead-issue-categories" class="striped-contract-style">
<thead>
<th><%= l(:field_overhead) %></th>
<th><%= l(:field_spent) %></th>
<th><%= l(:field_hours) %></th>
</thead>
<tbody>
<% deliverable.issue_categories_with_non_billable_time.sort.each do |category| %>
<% content_tag_for(:tr, category, :class => 'overhead ' + cycle('even','')) do %>
<td class="">
<%= h(category.name) %>
</td>
<td class="financial amount-cost">
<%= number_to_currency(deliverable.spent_for_issue_category(category, false), :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric time-cost">
<%= number_with_precision(deliverable.hours_spent_for_issue_category(category, false), :precision => Deliverable::ViewPrecision) %>
</td>
<% end %>
<% end %>
<% content_tag_for(:tr, IssueCategory.new, :class => 'labor ' + cycle('even','')) do %>
<td class="">
<%= l(:label_none) %>
</td>
<td class="financial amount-cost">
<%= number_to_currency(deliverable.spent_for_issue_category(nil, false), :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric time-cost">
<%= number_with_precision(deliverable.hours_spent_for_issue_category(nil, false), :precision => Deliverable::ViewPrecision) %>
</td>
<% end %>
<tr class="total summary-row overhead">
<td class="">
Totals
</td>
<td class="financial amount-cost">
<%= number_to_currency(deliverable.overhead_spent, :precision => Deliverable::ViewPrecision) %>
</td>
<td class="numeric time-cost">
<%= number_with_precision(deliverable.overhead_hours_spent_total, :precision => Deliverable::ViewPrecision) %>
</td>
</tr>
</tbody>
</table>
</div><%# /div.users %>
<% end %>