[#5442] Add contract totals for labor and overhead hours spent and budgeted
This commit is contained in:
1 parent
af0eecb6dc
commit
a92559c133
4 files changed
+51
-7
No files matched your search
@@ -55,6 +55,19 @@ class Contract < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
memoize :labor_spent
|
memoize :labor_spent
|
||||||
|
|
||||||
|
# OPTIMIZE: N+1
|
||||||
|
def labor_hour_budget
|
||||||
|
summarize_associated_values(deliverables, :labor_budget_hours)
|
||||||
|
end
|
||||||
|
memoize :labor_hour_budget
|
||||||
|
|
||||||
|
# OPTIMIZE: N+1
|
||||||
|
# OPTIMIZE: also hits redmine_overhead which is known to be slow
|
||||||
|
def labor_hour_spent
|
||||||
|
summarize_associated_values(deliverables, :labor_hours_spent_total)
|
||||||
|
end
|
||||||
|
memoize :labor_hour_spent
|
||||||
|
|
||||||
# OPTIMIZE: N+1
|
# OPTIMIZE: N+1
|
||||||
def overhead_budget
|
def overhead_budget
|
||||||
summarize_associated_values(deliverables, :overhead_budget_total)
|
summarize_associated_values(deliverables, :overhead_budget_total)
|
||||||
@@ -68,6 +81,19 @@ class Contract < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
memoize :overhead_spent
|
memoize :overhead_spent
|
||||||
|
|
||||||
|
# OPTIMIZE: N+1
|
||||||
|
def overhead_hour_budget
|
||||||
|
summarize_associated_values(deliverables, :overhead_budget_hours)
|
||||||
|
end
|
||||||
|
memoize :overhead_hour_budget
|
||||||
|
|
||||||
|
# OPTIMIZE: N+1
|
||||||
|
# OPTIMIZE: also hits redmine_overhead which is known to be slow
|
||||||
|
def overhead_hour_spent
|
||||||
|
summarize_associated_values(deliverables, :overhead_hours_spent_total)
|
||||||
|
end
|
||||||
|
memoize :overhead_hour_spent
|
||||||
|
|
||||||
# OPTIMIZE: N+1
|
# OPTIMIZE: N+1
|
||||||
def estimated_hour_budget
|
def estimated_hour_budget
|
||||||
summarize_associated_values(deliverables, :estimated_hour_budget_total)
|
summarize_associated_values(deliverables, :estimated_hour_budget_total)
|
||||||
|
|||||||
@@ -78,7 +78,15 @@
|
|||||||
<%= show_budget_field(resource, :total_spent, :total_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-total'}) %>
|
<%= show_budget_field(resource, :total_spent, :total_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-total'}) %>
|
||||||
<%= show_budget_field(resource, :billable_rate, 'nil?', :format => :format_hourly_rate, :html_options => {:class => 'contract-billable-rate total'}) %>
|
<%= show_budget_field(resource, :billable_rate, 'nil?', :format => :format_hourly_rate, :html_options => {:class => 'contract-billable-rate total'}) %>
|
||||||
|
|
||||||
<%= show_budget_field(resource, :estimated_hour_spent, :estimated_hour_budget, :format => :l_hours, :html_options => {:class => 'contract-estimated-hour total'}) %>
|
<tr>
|
||||||
|
<td colspan="3">
|
||||||
|
<div class="hr"></div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<%= show_budget_field(resource, :labor_hour_spent, :labor_hour_budget, :format => :l_hours, :html_options => {:class => 'contract-labor-hour'}) %>
|
||||||
|
<%= show_budget_field(resource, :overhead_hour_spent, :overhead_hour_budget, :format => :l_hours, :html_options => {:class => 'contract-overhead-hour'}) %>
|
||||||
|
<%= show_budget_field(resource, :estimated_hour_spent, :estimated_hour_budget, :format => :l_hours, :html_options => {:class => 'contract-total-hour total'}) %>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="stretch" colspan="3">
|
<td class="stretch" colspan="3">
|
||||||
<!-- Stretch table height -->
|
<!-- Stretch table height -->
|
||||||
|
|||||||
@@ -34,8 +34,11 @@ en:
|
|||||||
field_client_point_of_contact: "Point of Contact"
|
field_client_point_of_contact: "Point of Contact"
|
||||||
field_discount_budget: "Discount"
|
field_discount_budget: "Discount"
|
||||||
field_discount_spent: "Discount"
|
field_discount_spent: "Discount"
|
||||||
field_estimated_hour_budget: "Est. Hours"
|
field_estimated_hour_budget: "Total Hours"
|
||||||
field_estimated_hour_spent: "Est. Hours"
|
field_estimated_hour_spent: "Total Hours"
|
||||||
|
field_labor_hour_spent: "Labor Hours"
|
||||||
|
field_overhead_hour_spent: "Overhead Hours"
|
||||||
|
field_total_hours: "Total Hours"
|
||||||
field_fixed_budget: "Fixed"
|
field_fixed_budget: "Fixed"
|
||||||
field_fixed_spent: "Fixed"
|
field_fixed_spent: "Fixed"
|
||||||
field_labor_budget: "Labor"
|
field_labor_budget: "Labor"
|
||||||
@@ -78,3 +81,4 @@ en:
|
|||||||
text_error_message_orphaned_time: "There is {{amount}} worth of time clocked to issues that are not assigned to any deliverables."
|
text_error_message_orphaned_time: "There is {{amount}} worth of time clocked to issues that are not assigned to any deliverables."
|
||||||
text_error_message_update_orphaned_time: "Please update the orphaned issues."
|
text_error_message_update_orphaned_time: "Please update the orphaned issues."
|
||||||
field_estimated: Estimated
|
field_estimated: Estimated
|
||||||
|
|
||||||
@@ -82,8 +82,12 @@ class ContractsShowTest < ActionController::IntegrationTest
|
|||||||
|
|
||||||
assert_select '.contract-billable-rate'
|
assert_select '.contract-billable-rate'
|
||||||
|
|
||||||
assert_select '.contract-estimated-hour .spent'
|
assert_select '.contract-labor-hour .spent'
|
||||||
assert_select '.contract-estimated-hour .budget'
|
assert_select '.contract-labor-hour .budget'
|
||||||
|
assert_select '.contract-overhead-hour .spent'
|
||||||
|
assert_select '.contract-overhead-hour .budget'
|
||||||
|
assert_select '.contract-total-hour .spent'
|
||||||
|
assert_select '.contract-total-hour .budget'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -481,10 +485,12 @@ class ContractsShowTest < ActionController::IntegrationTest
|
|||||||
visit_contract_page(@contract)
|
visit_contract_page(@contract)
|
||||||
|
|
||||||
# Overages on:
|
# Overages on:
|
||||||
assert_select '.overage', :count => 12
|
assert_select '.overage', :count => 14
|
||||||
assert_select '.contract-labor .overage', :count => 2
|
assert_select '.contract-labor .overage', :count => 2
|
||||||
assert_select '.contract-overhead .overage', :count => 2
|
assert_select '.contract-overhead .overage', :count => 2
|
||||||
assert_select '.contract-estimated-hour.total .overage'
|
assert_select '.contract-labor-hour .overage'
|
||||||
|
assert_select '.contract-overhead-hour .overage'
|
||||||
|
assert_select '.contract-total-hour .overage'
|
||||||
|
|
||||||
assert_select '#deliverables .spent-amount.labor.overage'
|
assert_select '#deliverables .spent-amount.labor.overage'
|
||||||
assert_select '#deliverables .spent-amount.overhead.overage'
|
assert_select '#deliverables .spent-amount.overhead.overage'
|
||||||
|
|||||||
Reference in new issue
Block a user