[#4411] Round currency to 0 decimal places on the Contracts page.
This commit is contained in:
@@ -10,8 +10,8 @@ module ContractsHelper
|
|||||||
extra_css_class = options[:class] || ''
|
extra_css_class = options[:class] || ''
|
||||||
|
|
||||||
if total > 0 || spent > 0
|
if total > 0 || spent > 0
|
||||||
content_tag(:td, h(number_to_currency(spent, :unit => '')), :class => 'spent-amount ' + extra_css_class) +
|
content_tag(:td, h(format_value_field_for_contracts(spent)), :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(total)), :class => 'total-amount white ' + extra_css_class)
|
||||||
else
|
else
|
||||||
content_tag(:td, '----', :colspan => '2', :class => 'no-value ' + extra_css_class)
|
content_tag(:td, '----', :colspan => '2', :class => 'no-value ' + extra_css_class)
|
||||||
end
|
end
|
||||||
@@ -81,4 +81,8 @@ module ContractsHelper
|
|||||||
def format_deliverable_value_fields(value)
|
def format_deliverable_value_fields(value)
|
||||||
number_with_precision(value, :precision => Deliverable::ViewPrecision, :delimiter => '')
|
number_with_precision(value, :precision => Deliverable::ViewPrecision, :delimiter => '')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def format_value_field_for_contracts(value)
|
||||||
|
number_with_precision(value, :precision => Contract::ViewPrecision, :delimiter => ',')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
class Contract < ActiveRecord::Base
|
class Contract < ActiveRecord::Base
|
||||||
unloadable
|
unloadable
|
||||||
|
|
||||||
|
ViewPrecision = 0
|
||||||
|
|
||||||
# Associations
|
# Associations
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
belongs_to :account_executive, :class_name => 'User', :foreign_key => 'account_executive_id'
|
belongs_to :account_executive, :class_name => 'User', :foreign_key => 'account_executive_id'
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<table class="right">
|
<table class="right">
|
||||||
<%= show_budget_field(resource, :labor_spent, :labor_budget, :html_options => {:class => 'contract-labor'}, :label_html_options => {:width => '49%'}) %>
|
<%= 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, :html_options => {:class => 'contract-overhead'}) %>
|
<%= 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, :html_options => {:class => 'contract-total'}) %>
|
<%= show_budget_field(resource, :total_spent, :total_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-total'}) %>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
@@ -41,12 +41,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class="finance">
|
<table class="finance">
|
||||||
<%= show_budget_field(resource, :labor_spent, :labor_budget, :html_options => {:class => 'contract-labor'}, :label_html_options => {:width => '46%'}) %>
|
<%= 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, :html_options => {:class => 'contract-overhead'}) %>
|
<%= 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, :html_options => {:class => 'contract-fixed'}) %>
|
<%= 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, :html_options => {:class => 'contract-markup'}) %>
|
<%= 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, :html_options => {:class => 'contract-profit'}) %>
|
<%= 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, :html_options => {:class => 'contract-discount'}) %>
|
<%= show_budget_field(resource, :discount_spent, :discount_budget, :format => :format_value_field_for_contracts, :html_options => {:class => 'contract-discount'}) %>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<%= 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_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'}) %>
|
<%= show_budget_field(resource, :estimated_hour_spent, :estimated_hour_budget, :format => :l_hours, :html_options => {:class => 'contract-estimated-hour total'}) %>
|
||||||
@@ -148,28 +148,28 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="l"><a href="#"><strong>Labor</strong></a></td>
|
<td class="l"><a href="#"><strong>Labor</strong></a></td>
|
||||||
<td><%= h(deliverable.labor_budget_spent) %></td>
|
<td><%= h(format_value_field_for_contracts(deliverable.labor_budget_spent)) %></td>
|
||||||
<td><%= h(deliverable.labor_budget_total) %></td>
|
<td><%= h(format_value_field_for_contracts(deliverable.labor_budget_total)) %></td>
|
||||||
<td> TODO: Release 2 / TODO hrs </td>
|
<td> TODO: Release 2 / TODO hrs </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="l"><a href="#"><strong>Overhead</strong></a></td>
|
<td class="l"><a href="#"><strong>Overhead</strong></a></td>
|
||||||
<td><%= h(deliverable.overhead_spent) %></td>
|
<td><%= h(format_value_field_for_contracts(deliverable.overhead_spent)) %></td>
|
||||||
<td><%= h(deliverable.overhead_budget_total) %></td>
|
<td><%= h(format_value_field_for_contracts(deliverable.overhead_budget_total)) %></td>
|
||||||
<td> TODO: Release 2 / TODO hrs </td>
|
<td> TODO: Release 2 / TODO hrs </td>
|
||||||
</tr>
|
</tr>
|
||||||
<%# TODO: Release 2, Fixed %>
|
<%# TODO: Release 2, Fixed %>
|
||||||
<%# TODO: Release 2, Markup %>
|
<%# TODO: Release 2, Markup %>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="l">Profit</td>
|
<td class="l">Profit</td>
|
||||||
<td><%= h(deliverable.profit_left) %></td>
|
<td><%= h(format_value_field_for_contracts(deliverable.profit_left)) %></td>
|
||||||
<td><%= h(deliverable.profit_budget) %></td>
|
<td><%= h(format_value_field_for_contracts(deliverable.profit_budget)) %></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="total">
|
<tr class="total">
|
||||||
<td class="l"><strong>Total:</strong></td>
|
<td class="l"><strong>Total:</strong></td>
|
||||||
<td><strong><%= h(deliverable.total_spent) %></strong></td>
|
<td><strong><%= h(format_value_field_for_contracts(deliverable.total_spent)) %></strong></td>
|
||||||
<td><strong><%= h(deliverable.total) %></strong></td>
|
<td><strong><%= h(format_value_field_for_contracts(deliverable.total)) %></strong></td>
|
||||||
<td><strong>TODO: Release 2</strong></td>
|
<td><strong>TODO: Release 2</strong></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ class ContractsShowTest < ActionController::IntegrationTest
|
|||||||
|
|
||||||
visit_contract_page(@contract)
|
visit_contract_page(@contract)
|
||||||
assert_select "table#deliverables" do
|
assert_select "table#deliverables" do
|
||||||
assert_select "td.labor", :text => /4,200.50/
|
assert_select "td.labor", :text => /4,201/
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -137,7 +137,7 @@ class ContractsShowTest < ActionController::IntegrationTest
|
|||||||
|
|
||||||
visit_contract_page(@contract)
|
visit_contract_page(@contract)
|
||||||
assert_select "table#deliverables" do
|
assert_select "table#deliverables" do
|
||||||
assert_select "td.overhead", :text => /4,200.50/
|
assert_select "td.overhead", :text => /4,201/
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -171,7 +171,7 @@ class ContractsShowTest < ActionController::IntegrationTest
|
|||||||
|
|
||||||
visit_contract_page(@contract)
|
visit_contract_page(@contract)
|
||||||
assert_select "table#deliverables" do
|
assert_select "table#deliverables" do
|
||||||
assert_select "td.labor", :text => /1,000.00/
|
assert_select "td.labor", :text => /1,000/
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -205,7 +205,7 @@ class ContractsShowTest < ActionController::IntegrationTest
|
|||||||
|
|
||||||
visit_contract_page(@contract)
|
visit_contract_page(@contract)
|
||||||
assert_select "table#deliverables" do
|
assert_select "table#deliverables" do
|
||||||
assert_select "td.overhead", :text => /2,000.00/
|
assert_select "td.overhead", :text => /2,000/
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user