view_contract.html.erb 2.2 KB
<h1><%= @contract.client_name %></h1>

<table class='bsc-fields-table' style="float: left;">
  <tr>
    <th colspan='2'><%= _('Basic information') %></th>
  </tr>
  <%= display_text_field(_('Client type'), BscPlugin::Contract::ClientType.names[@contract.client_type]) %>
  <%= display_text_field(_('Business type'), BscPlugin::Contract::BusinessType.names[@contract.business_type]) %>
  <%= display_text_field(_('State'), @contract.state) %>
  <%= display_text_field(_('City'), @contract.city) %>
  <%= display_text_field(_('Status'), BscPlugin::Contract::Status.names[@contract.status]) %>
  <%= display_text_field(_('Number of producers'), @contract.number_of_producers) %>
  <%= display_text_field(_('Supply period'), show_period(@contract.supply_start, @contract.supply_end, true)) %>
</table>

<table class='bsc-fields-table' style="float: right;">
  <tr>
    <th colspan='2'><%= _('Enterprises') %></th>
  </tr>
  <%= display_list_field(@contract.enterprises.map {|enterprise| link_to(enterprise.short_name(60), enterprise.url)}) %>
</table>

<% if !@contract.sales.blank?%>
  <table id='bsc-plugin-sales-table' class="bsc-plugin-view-contract alternate-colors">
    <tr>
      <th><%= _('Product') %></th>
      <th align="center"><%= _('Quantity') %></th>
      <th><%= _('Unit price') %></th>
    </tr>
    <% @contract.sales.each do |sale| %>
      <tr>
        <td><%= short_text(product_display_name(Product.find(sale.product_id)), 110) %></td>
        <td align="center"><%= sale.quantity %></td>
        <td align="right"><%= float_to_currency(sale.price) %></td>
      </tr>
    <% end %>
    <tr>
      <td id="bsc-plugin-contract-total-string" class="bsc-plugin-total" colspan='2'><%= _('Total')%></td>
      <td id="bsc-plugin-contract-total" class="bsc-plugin-total"><%= float_to_currency(@contract.total_price) %></td>
    </tr>
  </table>
<% end %>

<br style="clear: both" />

<% if !@contract.annotations.blank? %>
  <div class="bsc-plugin-annotation">
    <div class="bsc-plugin-annotation-title"><%= _("Annotations") %></div>
    <div class="bsc-plugin-annotation-content"><%= @contract.annotations %></div>
  </div>
<% end %>

<% button_bar do %>
  <%= button(:back, _('Go back'), :action => 'manage_contracts') %>
<% end %>