This repository has been archived on 2024-12-01. You can view files and clone it, but cannot push or open issues or pull requests.
redmine_rodax_crm/app/views/contracts/_contracts_statistics.html.erb
2012-01-03 21:11:44 +00:00

26 lines
1.2 KiB
Plaintext

<% if contract_statuses.any? %>
<div id="contracts_statistics">
<% if !(@project && !authorize_for(:sale_funel, :index)) %>
<div class="contextual">
<%= link_to l(:label_sale_funel), {:controller => 'sale_funel', :action => 'index', :project_id => @project} %>
</div>
<% end %>
<h3><%= l(:label_statistics) %></h3>
<table class="contracts_statistics">
<% contract_statuses.each do |contract_status| %>
<tr>
<td>
<span class="contract-status" style=<%= "background-color:#{contract_status.color_name};color:white;" %> >
<%= h "#{contract_status.name}(#{@project ? @project.contracts.count(:conditions => {:status_id => contract_status.id}) : Contract.count(:conditions => {:status_id => contract_status.id})})" %>
</span>
</td>
<td>
<strong>
<%= @project ? contracts_sum_to_currency(@project.contracts.sum(:price, :conditions => {:status_id => contract_status.id}, :group => :currency)) : contracts_sum_to_currency(Contract.sum(:price, :conditions => {:status_id => contract_status.id}, :group => :currency)) %>
</strong>
</td>
</tr>
<% end %>
</table>
</div>
<% end %>