diff --git a/app/helpers/contracts_helper.rb b/app/helpers/contracts_helper.rb index 8f60e0e..a7bfb94 100644 --- a/app/helpers/contracts_helper.rb +++ b/app/helpers/contracts_helper.rb @@ -10,8 +10,8 @@ module ContractsHelper extra_css_class = options[:class] || '' if total > 0 || spent > 0 - content_tag(:td, h(number_to_currency(spent, :unit => '')), :class => 'spent-amount ' + extra_css_class) + - content_tag(:td, h(number_to_currency(total, :unit => '')), :class => 'total-amount white ' + extra_css_class) + content_tag(:td, h(format_value_field_for_contracts(spent)), :class => 'spent-amount ' + extra_css_class) + + content_tag(:td, h(format_value_field_for_contracts(total)), :class => 'total-amount white ' + extra_css_class) else content_tag(:td, '----', :colspan => '2', :class => 'no-value ' + extra_css_class) end @@ -81,4 +81,8 @@ module ContractsHelper def format_deliverable_value_fields(value) number_with_precision(value, :precision => Deliverable::ViewPrecision, :delimiter => '') end + + def format_value_field_for_contracts(value) + number_with_precision(value, :precision => Contract::ViewPrecision, :delimiter => ',') + end end diff --git a/app/models/contract.rb b/app/models/contract.rb index 2ca4c13..c111536 100644 --- a/app/models/contract.rb +++ b/app/models/contract.rb @@ -1,6 +1,8 @@ class Contract < ActiveRecord::Base unloadable + ViewPrecision = 0 + # Associations belongs_to :project belongs_to :account_executive, :class_name => 'User', :foreign_key => 'account_executive_id' diff --git a/app/views/contracts/show.html.erb b/app/views/contracts/show.html.erb index 0267b65..564d3c0 100644 --- a/app/views/contracts/show.html.erb +++ b/app/views/contracts/show.html.erb @@ -17,9 +17,9 @@ - <%= show_budget_field(resource, :labor_spent, :labor_budget, :html_options => {:class => 'contract-labor'}, :label_html_options => {:width => '49%'}) %> - <%= show_budget_field(resource, :overhead_spent, :overhead_budget, :html_options => {:class => 'contract-overhead'}) %> - <%= show_budget_field(resource, :total_spent, :total_budget, :html_options => {:class => 'contract-total'}) %> + <%= show_budget_field(resource, :labor_spent, :labor_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-labor'}, :label_html_options => {:width => '49%'}) %> + <%= show_budget_field(resource, :overhead_spent, :overhead_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-overhead'}) %> + <%= show_budget_field(resource, :total_spent, :total_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-total'}) %>
@@ -41,12 +41,12 @@ - <%= show_budget_field(resource, :labor_spent, :labor_budget, :html_options => {:class => 'contract-labor'}, :label_html_options => {:width => '46%'}) %> - <%= show_budget_field(resource, :overhead_spent, :overhead_budget, :html_options => {:class => 'contract-overhead'}) %> - <%= show_budget_field(resource, :fixed_spent, :fixed_budget, :html_options => {:class => 'contract-fixed'}) %> - <%= show_budget_field(resource, :markup_spent, :markup_budget, :html_options => {:class => 'contract-markup'}) %> - <%= show_budget_field(resource, :profit_spent, :profit_budget, :html_options => {:class => 'contract-profit'}) %> - <%= show_budget_field(resource, :discount_spent, :discount_budget, :html_options => {:class => 'contract-discount'}) %> + <%= show_budget_field(resource, :labor_spent, :labor_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-labor'}, :label_html_options => {:width => '46%'}) %> + <%= show_budget_field(resource, :overhead_spent, :overhead_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-overhead'}) %> + <%= show_budget_field(resource, :fixed_spent, :fixed_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-fixed'}) %> + <%= show_budget_field(resource, :markup_spent, :markup_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-markup'}) %> + <%= show_budget_field(resource, :profit_spent, :profit_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-profit'}) %> + <%= show_budget_field(resource, :discount_spent, :discount_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-discount'}) %> - <%= show_budget_field(resource, :total_spent, :total_budget, :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_field(resource, :billable_rate, :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'}) %> @@ -148,28 +148,28 @@ - - + + - - + + <%# TODO: Release 2, Fixed %> <%# TODO: Release 2, Markup %> - - + + - - + + diff --git a/test/integration/contracts_show_test.rb b/test/integration/contracts_show_test.rb index a49b25c..9fc63d5 100644 --- a/test/integration/contracts_show_test.rb +++ b/test/integration/contracts_show_test.rb @@ -119,7 +119,7 @@ class ContractsShowTest < ActionController::IntegrationTest visit_contract_page(@contract) assert_select "table#deliverables" do - assert_select "td.labor", :text => /4,200.50/ + assert_select "td.labor", :text => /4,201/ end end @@ -137,7 +137,7 @@ class ContractsShowTest < ActionController::IntegrationTest visit_contract_page(@contract) assert_select "table#deliverables" do - assert_select "td.overhead", :text => /4,200.50/ + assert_select "td.overhead", :text => /4,201/ end end @@ -171,7 +171,7 @@ class ContractsShowTest < ActionController::IntegrationTest visit_contract_page(@contract) assert_select "table#deliverables" do - assert_select "td.labor", :text => /1,000.00/ + assert_select "td.labor", :text => /1,000/ end end @@ -205,7 +205,7 @@ class ContractsShowTest < ActionController::IntegrationTest visit_contract_page(@contract) assert_select "table#deliverables" do - assert_select "td.overhead", :text => /2,000.00/ + assert_select "td.overhead", :text => /2,000/ end end
@@ -54,7 +54,7 @@
Labor<%= h(deliverable.labor_budget_spent) %><%= h(deliverable.labor_budget_total) %><%= h(format_value_field_for_contracts(deliverable.labor_budget_spent)) %><%= h(format_value_field_for_contracts(deliverable.labor_budget_total)) %> TODO: Release 2 / TODO hrs
Overhead<%= h(deliverable.overhead_spent) %><%= h(deliverable.overhead_budget_total) %><%= h(format_value_field_for_contracts(deliverable.overhead_spent)) %><%= h(format_value_field_for_contracts(deliverable.overhead_budget_total)) %> TODO: Release 2 / TODO hrs
Profit<%= h(deliverable.profit_left) %><%= h(deliverable.profit_budget) %><%= h(format_value_field_for_contracts(deliverable.profit_left)) %><%= h(format_value_field_for_contracts(deliverable.profit_budget)) %>
Total:<%= h(deliverable.total_spent) %><%= h(deliverable.total) %><%= h(format_value_field_for_contracts(deliverable.total_spent)) %><%= h(format_value_field_for_contracts(deliverable.total)) %> TODO: Release 2