view_contract.html.erb
2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<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 %>