inventorymaster 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/inventorymaster/products_helper.rb +9 -1
- data/app/models/inventorymaster/product.rb +1 -1
- data/app/models/inventorymaster/transaction.rb +1 -0
- data/app/views/inventorymaster/products/index.html.erb +15 -2
- data/app/views/inventorymaster/products/show.html.erb +40 -17
- data/app/views/inventorymaster/transactions/_form.html.erb +2 -1
- data/config/initializers/format_money.rb +11 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d09361368f333253ad8197b441edca6a9922995
|
4
|
+
data.tar.gz: 71940e1320e0e7b8081e70c132de4d440ac84f0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6b3309797d11e643a41c7794ee129ef907a1f40b2e39b0c2b9f509346e2e951e3b62662144f4d520ebf93dfcdc890e705b4a57ee3794f7c05c9657bf56f19e3
|
7
|
+
data.tar.gz: e185202b758ba3a3a8739b1f95a779f24d3984ee4d95f4b95b2be38f6aaa974f57edb438819c81de648dfb05196609570130456c6d79c15abfc46adc9a545a29
|
@@ -71,8 +71,21 @@
|
|
71
71
|
<td><span class="label label-warning"><%= product.minimum_stock_count %></span></td>
|
72
72
|
<td><span class="label label-primary"><%= product.ammount %></span></td>
|
73
73
|
<td><%= link_to 'Detalhar', product ,:class=>"btn btn-xs btn-default"%></td>
|
74
|
-
<td
|
75
|
-
|
74
|
+
<td>
|
75
|
+
<%= form_tag({:controller=>'transactions',:action=>'new'}, {:method => :get}) do %>
|
76
|
+
<%= hidden_field_tag 'product_id',nil,:value => product.id%>
|
77
|
+
<%= hidden_field_tag 'kind',nil,:value => "Entrada"%>
|
78
|
+
<%= submit_tag("+ Entrada", :class => 'btn btn-xs btn-success') %>
|
79
|
+
<% end %>
|
80
|
+
</td>
|
81
|
+
<td>
|
82
|
+
<%= form_tag({:controller=>'transactions',:action=>'new'}, {:method => :get}) do %>
|
83
|
+
<%= hidden_field_tag 'product_id',nil,:value => product.id%>
|
84
|
+
<%= hidden_field_tag 'kind',nil,:value => "Saida"%>
|
85
|
+
<%= submit_tag("+ Saida", :class => 'btn btn-xs btn-danger') %>
|
86
|
+
<% end %>
|
87
|
+
</td>
|
88
|
+
|
76
89
|
</tr>
|
77
90
|
<% end %>
|
78
91
|
</tbody>
|
@@ -1,24 +1,46 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
|
3
|
+
<table >
|
4
|
+
<tr>
|
5
|
+
<td><%= link_to 'Voltar', products_path,:class=>"btn btn-default btn-xs" %></td>
|
6
|
+
<td> </td>
|
7
|
+
<td><%= link_to 'Editar', edit_product_path(@product) ,:class=>"btn btn-xs btn-warning"%></td>
|
8
|
+
<td> </td>
|
9
|
+
<td><%= link_to 'Deletar', @product, method: :delete, data: { confirm: 'Voce tem Certeza?' },:class=>"btn btn-xs btn-danger" %></td>
|
10
|
+
<td> </td>
|
11
|
+
<td>
|
12
|
+
<%= form_tag({:controller=>'transactions',:action=>'new'}, {:method => :get}) do %>
|
3
13
|
<%= hidden_field_tag 'product_id',nil,:value => @product.id%>
|
4
14
|
<%= hidden_field_tag 'kind',nil,:value => "Entrada"%>
|
5
|
-
<%= submit_tag("+ Entrada", :class => 'btn btn-
|
15
|
+
<%= submit_tag("+ Entrada", :class => 'btn btn-xs btn-success') %>
|
6
16
|
<% end %>
|
7
17
|
|
8
|
-
|
18
|
+
|
19
|
+
</td>
|
20
|
+
<td> </td>
|
21
|
+
<td>
|
22
|
+
<%= form_tag({:controller=>'transactions',:action=>'new'}, {:method => :get}) do %>
|
9
23
|
<%= hidden_field_tag 'product_id',nil,:value => @product.id%>
|
10
24
|
<%= hidden_field_tag 'kind',nil,:value => "Saida"%>
|
11
|
-
<%= submit_tag("+ Saida", :class => 'btn btn-
|
25
|
+
<%= submit_tag("+ Saida", :class => 'btn btn-xs btn-danger') %>
|
12
26
|
<% end %>
|
13
|
-
|
14
|
-
|
15
|
-
|
27
|
+
|
28
|
+
</td>
|
29
|
+
</tr>
|
30
|
+
</table>
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
<br>
|
36
|
+
<br>
|
37
|
+
<p>
|
16
38
|
<strong>Quantidade em Estoque:</strong>
|
17
39
|
<span class="label label-primary"><%= @product.ammount %></span>
|
18
40
|
</p>
|
19
41
|
<p>
|
20
42
|
<strong>Nome:</strong>
|
21
|
-
<%= @product.name %>
|
43
|
+
<%= @product.name.upcase %>
|
22
44
|
</p>
|
23
45
|
|
24
46
|
<p>
|
@@ -43,12 +65,12 @@
|
|
43
65
|
|
44
66
|
<p>
|
45
67
|
<strong>Area:</strong>
|
46
|
-
<%= @product.
|
68
|
+
<%= @product.area.name%>
|
47
69
|
</p>
|
48
70
|
|
49
71
|
<p>
|
50
72
|
<strong>Fabricante:</strong>
|
51
|
-
<%= @product.
|
73
|
+
<%= @product.manufacturer.name %>
|
52
74
|
</p>
|
53
75
|
|
54
76
|
<p>
|
@@ -56,8 +78,9 @@
|
|
56
78
|
<%= @product.minimum_stock_count %>
|
57
79
|
</p>
|
58
80
|
|
59
|
-
|
60
|
-
|
81
|
+
<%@average=0%>
|
82
|
+
<%@cost=0%>
|
83
|
+
|
61
84
|
<hr>
|
62
85
|
<table class="table table-striped" style="text-align:left;">
|
63
86
|
<tr>
|
@@ -71,17 +94,17 @@
|
|
71
94
|
<td>Custo Medio</td>
|
72
95
|
<td>Motivo</td>
|
73
96
|
</tr>
|
74
|
-
<%@product.transactions.each do |transaction|%>
|
97
|
+
<%@product.transactions.order("created_at ASC").each do |transaction|%>
|
75
98
|
<tr>
|
76
99
|
<td><%=transaction.kind%></td>
|
77
100
|
<td><%=transaction.date.strftime("%d/%m/%Y")%></td>
|
78
101
|
<td><%=transaction.user.first_name unless transaction.user.nil?%></td>
|
79
102
|
<td><%if transaction.upc.present?%><%=transaction.upc%><%else%>-<%end%></td>
|
80
|
-
<td><%=transaction.unit_cost%></td>
|
81
|
-
<td><%=transaction.unit_sale%></td>
|
103
|
+
<td><%=number_to_currency(transaction.unit_cost,:precision=>2)%></td>
|
104
|
+
<td><%=number_to_currency(transaction.unit_sale,:precision=>2)%></td>
|
82
105
|
<td><%if transaction.kind == "Saida"%><font color="red">-</font><%else%><font color="blue">+</font><%end%><%=transaction.ammount%></td>
|
83
|
-
<td><%=transaction.
|
84
|
-
<td><%=transaction.
|
106
|
+
<td><%=number_to_currency(average_cost(transaction.unit_cost,transaction.ammount),:precision=>2)%></td>
|
107
|
+
<td><%=transaction.transaction_type.name%></td>
|
85
108
|
</tr>
|
86
109
|
|
87
110
|
<%end%>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
</div>
|
12
12
|
<% end %>
|
13
13
|
|
14
|
-
|
14
|
+
<%= f.hidden_field :user_id, :value => current_user.id %>
|
15
15
|
|
16
16
|
<div class="field" style="display:none;">
|
17
17
|
<%= f.label :product_id ,"Produto"%><br>
|
@@ -31,6 +31,7 @@
|
|
31
31
|
<%= f.label :upc ,"UPC"%><br>
|
32
32
|
<%= f.text_field :upc %>
|
33
33
|
</div>
|
34
|
+
|
34
35
|
<div class="field">
|
35
36
|
<%= f.label :unit_cost,"Custo Unitário" %><br>
|
36
37
|
<%= f.text_field :unit_cost %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module ActionView
|
2
|
+
module Helpers
|
3
|
+
module NumberHelper
|
4
|
+
def number_to_currency_with_real(number, options = {})
|
5
|
+
defaults = {:unit => 'R$', :format => "%u %n", :separator => ",", :delimiter => "."}
|
6
|
+
s = number_to_currency_without_real(number, defaults.merge(options))
|
7
|
+
end
|
8
|
+
alias_method_chain :number_to_currency, :real
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inventorymaster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jcottobboni
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- app/views/inventorymaster/transactions/new.html.erb
|
153
153
|
- app/views/inventorymaster/transactions/show.html.erb
|
154
154
|
- app/views/layouts/inventorymaster/application.html.erb
|
155
|
+
- config/initializers/format_money.rb
|
155
156
|
- config/initializers/kaminari_config.rb
|
156
157
|
- config/routes.rb
|
157
158
|
- db/migrate/20150502125839_create_inventorymaster_locations.rb
|