inventorymaster 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d09361368f333253ad8197b441edca6a9922995
4
- data.tar.gz: 71940e1320e0e7b8081e70c132de4d440ac84f0a
3
+ metadata.gz: 39188e3daa3ed88ed7ece16fcfbc9b9f8d7dce9e
4
+ data.tar.gz: ccdd24592a651549a671ebc8de3f51a0b275d207
5
5
  SHA512:
6
- metadata.gz: e6b3309797d11e643a41c7794ee129ef907a1f40b2e39b0c2b9f509346e2e951e3b62662144f4d520ebf93dfcdc890e705b4a57ee3794f7c05c9657bf56f19e3
7
- data.tar.gz: e185202b758ba3a3a8739b1f95a779f24d3984ee4d95f4b95b2be38f6aaa974f57edb438819c81de648dfb05196609570130456c6d79c15abfc46adc9a545a29
6
+ metadata.gz: a5c3110201c12121dd13ec72fcacf67387e809ecf600b122d4e76de32e2e8e39fd651f45ad808326822d729a2b9b55eab518078d9f9077d15ebe0e329e75459f
7
+ data.tar.gz: 0f18dbffef3181690b858522177d81a785e0f592b1c70d2495887612ffce48c30c85f337422cd73602b9187a8abb813ac92da2281d0d75a66db3c441169b7456
@@ -11,6 +11,9 @@ module Inventorymaster
11
11
  # end
12
12
 
13
13
  def index
14
+ @locations = Location.all
15
+ @areas = Area.all
16
+ @manufacturers = Manufacturer.all
14
17
  if params[:query].present?
15
18
  @products = Product.search(params[:query], page: params[:page])
16
19
  else
@@ -20,6 +23,19 @@ module Inventorymaster
20
23
 
21
24
  # GET /products/1
22
25
  def show
26
+ respond_to do |format|
27
+ format.html
28
+ format.pdf do
29
+ @pdf = WickedPdf.new.pdf_from_string(
30
+ render_to_string('show.pdf.erb'),
31
+ :encoding => "UTF-8",
32
+ :orientation => 'Landscape',
33
+ :footer => { :right => 'Pagina [page] de [topage]' }
34
+ )
35
+ send_data(@pdf, :filename => "relatorio_detalhado_#{@product.name}_para_a_data_#{DateTime.now.strftime('%d-%m-%Y_as_%H-%M')}.pdf", :type=>"application/pdf")
36
+
37
+ end
38
+ end
23
39
  end
24
40
 
25
41
  # GET /products/new
@@ -89,7 +105,7 @@ module Inventorymaster
89
105
 
90
106
  # Only allow a trusted parameter "white list" through.
91
107
  def product_params
92
- params.require(:product).permit(:name, :sku, :upc, :summary, :labels, :area_id, :manufacturer_id, :minimum_stock_count,:transactions_attributes=>[:id,:kind, :date, :location_id, :user_id, :upc, :unit_cost, :unit_sale, :ammount, :average_cost, :reason, :comment, :serial_number, :transaction_type_id,:product_id])
108
+ params.require(:product).permit(:name, :sku, :upc, :summary, :labels, :area_id,:location_id ,:manufacturer_id, :minimum_stock_count,:transactions_attributes=>[:id,:kind, :date, :location_id, :user_id, :upc, :unit_cost, :unit_sale, :ammount, :average_cost, :reason, :comment, :serial_number, :transaction_type_id,:product_id])
93
109
  end
94
110
  end
95
111
  end
@@ -0,0 +1,123 @@
1
+ module Inventorymaster
2
+ class ReportsController < ApplicationController
3
+
4
+ def index
5
+ @locations = Location.all
6
+ @areas = Area.all
7
+ @manufacturers = Manufacturer.all
8
+
9
+ end
10
+
11
+ def current_stock_list
12
+ if params[:location].blank? and params[:area].blank? and params[:manufacturer].blank?
13
+ @products = Product.all
14
+ elsif params[:location].blank? and params[:area].blank?
15
+ @products = Product.where(:manufacturer_id=>params[:manufacturer])
16
+ elsif params[:location].blank? and params[:manufacturer].blank?
17
+ @products = Product.where(:area_id=>params[:area])
18
+ elsif params[:area].blank? and params[:manufacturer].blank?
19
+ @products = Product.where(:location_id=>params[:location])
20
+ else
21
+ @products = Product.where(:location_id=>params[:location],:area_id=>params[:area],:manufacturer_id=>params[:manufacturer])
22
+ end
23
+
24
+ respond_to do |format|
25
+ format.html
26
+ format.pdf do
27
+ @pdf = WickedPdf.new.pdf_from_string(
28
+ render_to_string('current_stock_list.pdf.erb'),
29
+ :encoding => "UTF-8",
30
+ :orientation => 'Landscape',
31
+ :footer => { :right => 'Pagina [page] de [topage]' }
32
+ )
33
+ send_data(@pdf, :filename => "relatorio_estoque_atual_para_a_data_#{DateTime.now.strftime('%d-%m-%Y_as_%H-%M')}.pdf", :type=>"application/pdf")
34
+
35
+ end
36
+ end
37
+ end
38
+
39
+
40
+ def moviments_by_months
41
+ @moviments = Transaction.all
42
+ @moviments_months = @moviments.group_by { |t| t.date.beginning_of_month }
43
+ respond_to do |format|
44
+ format.html
45
+ format.pdf do
46
+ @pdf = WickedPdf.new.pdf_from_string(
47
+ render_to_string('moviments_by_months.pdf.erb'),
48
+ :encoding => "UTF-8",
49
+ :orientation => 'Landscape',
50
+ :footer => { :right => 'Pagina [page] de [topage]' }
51
+ )
52
+ send_data(@pdf, :filename => "relatorio_movimentacoes_por_meses_gerado_em#{DateTime.now.strftime('%d-%m-%Y_as_%H-%M')}.pdf", :type=>"application/pdf")
53
+
54
+ end
55
+ end
56
+ end
57
+
58
+ def low_stock_list
59
+ if params[:location].blank? and params[:area].blank? and params[:manufacturer].blank?
60
+ @products = Product.where(' ammount <= minimum_stock_count')
61
+ elsif params[:location].blank? and params[:area].blank?
62
+ @products = Product.where(' ammount <= minimum_stock_count and manufacturer_id=?',params[:manufacturer])
63
+ elsif params[:location].blank? and params[:manufacturer].blank?
64
+ @products = Product.where(:area_id=>params[:area])
65
+ @products = Product.where(' ammount <= minimum_stock_count and area_id=?',params[:area])
66
+ elsif params[:area].blank? and params[:manufacturer].blank?
67
+ @products = Product.where(:location_id=>params[:location])
68
+ @products = Product.where(' ammount <= minimum_stock_count and location_id=?',params[:location])
69
+ else
70
+ @products = Product.where(:location_id=>params[:location],:area_id=>params[:area],:manufacturer_id=>params[:manufacturer])
71
+ @products = Product.where(' ammount <= minimum_stock_count and location_id=? and area_id=? and manufacturer_id=?',params[:location],params[:area],params[:manufacturer])
72
+ end
73
+
74
+ respond_to do |format|
75
+ format.html
76
+ format.pdf do
77
+ @pdf = WickedPdf.new.pdf_from_string(
78
+ render_to_string('low_stock_list.pdf.erb'),
79
+ :encoding => "UTF-8",
80
+ :orientation => 'Landscape',
81
+ :footer => { :right => 'Pagina [page] de [topage]' }
82
+ )
83
+ send_data(@pdf, :filename => "Items_estoque_baixo_gerado_em#{DateTime.now.strftime('%d-%m-%Y_as_%H-%M')}.pdf", :type=>"application/pdf")
84
+
85
+ end
86
+ end
87
+ end
88
+
89
+
90
+ def out_stock_list
91
+ if params[:location].blank? and params[:area].blank? and params[:manufacturer].blank?
92
+ @products = Product.where(' ammount = 0')
93
+ elsif params[:location].blank? and params[:area].blank?
94
+ @products = Product.where(' ammount = 0 and manufacturer_id=?',params[:manufacturer])
95
+ elsif params[:location].blank? and params[:manufacturer].blank?
96
+ @products = Product.where(:area_id=>params[:area])
97
+ @products = Product.where(' ammount = 0 and area_id=?',params[:area])
98
+ elsif params[:area].blank? and params[:manufacturer].blank?
99
+ @products = Product.where(:location_id=>params[:location])
100
+ @products = Product.where(' ammount = 0 and location_id=?',params[:location])
101
+ else
102
+ @products = Product.where(:location_id=>params[:location],:area_id=>params[:area],:manufacturer_id=>params[:manufacturer])
103
+ @products = Product.where(' ammount = 0 and location_id=? and area_id=? and manufacturer_id=?',params[:location],params[:area],params[:manufacturer])
104
+ end
105
+
106
+ respond_to do |format|
107
+ format.html
108
+ format.pdf do
109
+ @pdf = WickedPdf.new.pdf_from_string(
110
+ render_to_string('low_stock_list.pdf.erb'),
111
+ :encoding => "UTF-8",
112
+ :orientation => 'Landscape',
113
+ :footer => { :right => 'Pagina [page] de [topage]' }
114
+ )
115
+ send_data(@pdf, :filename => "relatorio_items_estoque_zerado_gerado_em#{DateTime.now.strftime('%d-%m-%Y_as_%H-%M')}.pdf", :type=>"application/pdf")
116
+
117
+ end
118
+ end
119
+ end
120
+
121
+
122
+ end
123
+ end
@@ -2,7 +2,11 @@ module Inventorymaster
2
2
  module ProductsHelper
3
3
  def average_cost(unit_cost,ammount)
4
4
  if unit_cost == nil
5
- return @cost / @average
5
+ if @cost || @average ==0
6
+ return 0
7
+ else
8
+ return @cost / @average
9
+ end
6
10
  else
7
11
  @average += ammount
8
12
  @cost += unit_cost* ammount
@@ -0,0 +1,17 @@
1
+ module Inventorymaster
2
+ module ReportsHelper
3
+ def average_cost(unit_cost,ammount)
4
+ if unit_cost == nil
5
+ if @cost || @average ==0
6
+ return 0
7
+ else
8
+ return @cost / @average
9
+ end
10
+ else
11
+ @average += ammount
12
+ @cost += unit_cost* ammount
13
+ return @cost / @average
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,6 +1,8 @@
1
1
  module Inventorymaster
2
2
  class Product < ActiveRecord::Base
3
- searchkick autocomplete: ['name','sku']
3
+ searchkick callbacks: :async,autocomplete: ['name','sku']
4
+
5
+
4
6
  belongs_to :location
5
7
  belongs_to :area
6
8
  belongs_to :manufacturer
@@ -3,5 +3,6 @@ module Inventorymaster
3
3
  belongs_to :location
4
4
  belongs_to :user
5
5
  belongs_to :transaction_type
6
+ belongs_to :product
6
7
  end
7
8
  end
@@ -3,7 +3,7 @@
3
3
  </div>
4
4
  <div align="right"><%= link_to 'Inserir Area', new_area_path ,:class=>"btn btn-primary"%></div>
5
5
  <br>
6
-
6
+ <div class="table-responsive">
7
7
  <table class="table table-condesed">
8
8
 
9
9
  <thead>
@@ -24,6 +24,6 @@
24
24
  <% end %>
25
25
  </tbody>
26
26
  </table>
27
-
27
+ </div>
28
28
  <br>
29
29
 
@@ -3,7 +3,7 @@
3
3
  </div>
4
4
  <div align="right"><%= link_to 'Inserir Localização', new_location_path ,:class=>"btn btn-primary"%></div>
5
5
  <br>
6
-
6
+ <div class="table-responsive">
7
7
  <table class="table table-condesed">
8
8
  <thead>
9
9
  <tr>
@@ -31,6 +31,6 @@
31
31
  <% end %>
32
32
  </tbody>
33
33
  </table>
34
-
34
+ </div>
35
35
  <br>
36
36
 
@@ -3,7 +3,7 @@
3
3
  </div>
4
4
  <div align="right"><%= link_to 'Inserir Fabricante', new_manufacturer_path ,:class=>"btn btn-primary"%></div>
5
5
  <br>
6
-
6
+ <div class="table-responsive">
7
7
  <table class="table table-condesed">
8
8
  <thead>
9
9
  <tr>
@@ -25,6 +25,6 @@
25
25
  <% end %>
26
26
  </tbody>
27
27
  </table>
28
-
28
+ </div>
29
29
  <br>
30
30
 
@@ -22,6 +22,7 @@
22
22
  </div>
23
23
  </div>
24
24
  </div>
25
+
25
26
  <%end%>
26
27
 
27
28
 
@@ -34,7 +35,7 @@
34
35
 
35
36
  <div align="right"><%= link_to 'Inserir Produto', new_product_path ,:class=>"btn btn-primary"%></div>
36
37
  <br>
37
-
38
+ <div class="table-responsive">
38
39
  <table class="table table-condesed">
39
40
  <thead>
40
41
  <tr>
@@ -64,7 +65,7 @@
64
65
  <%end%>
65
66
  <%end%>
66
67
 
67
- <td><%= product.name %></td>
68
+ <td><%= product.name.upcase %></td>
68
69
  <td><%if product.sku.present?%><%= product.sku %><%else%>-<%end%></td>
69
70
  <td><%= product.area.name unless product.area.nil? %></td>
70
71
  <td><%= product.manufacturer.name unless product.manufacturer.nil?%></td>
@@ -90,8 +91,10 @@
90
91
  <% end %>
91
92
  </tbody>
92
93
  </table>
94
+ </div>
93
95
  <br>
94
96
  <center><%= paginate @products %></center>
95
97
 
96
98
  <span class="label label-warning">EM - Estoque Mínimo</span>
97
- <span class="label label-primary">EA - Estoque Atual</span>
99
+ <span class="label label-primary">EA - Estoque Atual</span>
100
+ <span class="label label-info">Stock Keeping Unit (SKU) - Unidade de Manutenção de Estoque</span>
@@ -15,7 +15,7 @@
15
15
 
16
16
  <div class="field">
17
17
  <%= f.label :name ,"Nome"%><br>
18
- <%= f.text_field :name %>
18
+ <%= f.text_field :name,:required=>true %>
19
19
  </div>
20
20
  <div class="field">
21
21
  <%= f.label :sku ,"SKU"%><br>
@@ -26,6 +26,8 @@
26
26
  <% end %>
27
27
 
28
28
  </td>
29
+ <td>&nbsp;</td>
30
+ <td><%=link_to 'Gerar Relatório Produto', product_path(@product, :format => :pdf),:class=>"btn btn-info btn-xs"%></td>
29
31
  </tr>
30
32
  </table>
31
33
 
@@ -82,16 +84,17 @@
82
84
  <%@cost=0%>
83
85
 
84
86
  <hr>
87
+ <div class="table-responsive">
85
88
  <table class="table table-striped" style="text-align:left;">
86
- <tr>
89
+ <tr style="font-weight: bold;">
87
90
  <td>Tipo</td>
88
91
  <td>Data</td>
89
92
  <td>Usuário</td>
90
93
  <td>UPC</td>
91
- <td>Custo Unitario</td>
94
+ <td>Custo Unitário</td>
92
95
  <td>Valor de Venda</td>
93
96
  <td>QTD</td>
94
- <td>Custo Medio</td>
97
+ <td>Custo Médio</td>
95
98
  <td>Motivo</td>
96
99
  </tr>
97
100
  <%@product.transactions.order("created_at ASC").each do |transaction|%>
@@ -104,12 +107,12 @@
104
107
  <td><%=number_to_currency(transaction.unit_sale,:precision=>2)%></td>
105
108
  <td><%if transaction.kind == "Saida"%><font color="red">-</font><%else%><font color="blue">+</font><%end%><%=transaction.ammount%></td>
106
109
  <td><%=number_to_currency(average_cost(transaction.unit_cost,transaction.ammount),:precision=>2)%></td>
107
- <td><%=transaction.transaction_type.name%></td>
110
+ <td><%=transaction.transaction_type.name unless transaction.transaction_type.nil?%></td>
108
111
  </tr>
109
112
 
110
113
  <%end%>
111
114
  </table>
112
-
115
+ </div>
113
116
 
114
117
 
115
118
 
@@ -0,0 +1,76 @@
1
+ <style type="text/css">
2
+ <%= Rails.application.assets.find_asset('bootstrap_and_overrides.css.less').to_s.html_safe %>
3
+ </style>
4
+ <p>
5
+ <h2><%= @product.name.upcase %></h2>
6
+ </p>
7
+ <p>
8
+ <strong>Quantidade em Estoque:</strong>
9
+ <span class="label label-primary"><%= @product.ammount %></span>
10
+ </p>
11
+ <p>
12
+ <strong>SKU:</strong>
13
+ <%= @product.sku %>
14
+ </p>
15
+ <p>
16
+ <strong>UPC:</strong>
17
+ <%= @product.upc %>
18
+ </p>
19
+ <p>
20
+ <strong>Descrição:</strong>
21
+ <%= @product.summary %>
22
+ </p>
23
+ <p>
24
+ <strong>Labels:</strong>
25
+ <%= @product.labels %>
26
+ </p>
27
+ <p>
28
+ <strong>Area:</strong>
29
+ <%= @product.area.name%>
30
+ </p>
31
+ <p>
32
+ <strong>Fabricante:</strong>
33
+ <%= @product.manufacturer.name %>
34
+ </p>
35
+ <p>
36
+ <strong>Estoque Minimo:</strong>
37
+ <%= @product.minimum_stock_count %>
38
+ </p>
39
+ <%@average=0%>
40
+ <%@cost=0%>
41
+ <h3>Histórico de movimentações</h3>
42
+ <hr>
43
+ <div class="table-responsive">
44
+ <table class="table table-striped" style="text-align:left;">
45
+ <tr style="font-weight: bold;">
46
+ <td>Tipo</td>
47
+ <td>Data</td>
48
+ <td>Usuário</td>
49
+ <td>UPC</td>
50
+ <td>Custo Unitário</td>
51
+ <td>Valor de Venda</td>
52
+ <td>QTD</td>
53
+ <td>Custo Médio</td>
54
+ <td>Motivo</td>
55
+ </tr>
56
+ <%@product.transactions.order("created_at ASC").each do |transaction|%>
57
+ <tr>
58
+ <td><%=transaction.kind%></td>
59
+ <td><%=transaction.date.strftime("%d/%m/%Y")%></td>
60
+ <td><%=transaction.user.first_name unless transaction.user.nil?%></td>
61
+ <td><%if transaction.upc.present?%><%=transaction.upc%><%else%>-<%end%></td>
62
+ <td><%=number_to_currency(transaction.unit_cost,:precision=>2)%></td>
63
+ <td><%=number_to_currency(transaction.unit_sale,:precision=>2)%></td>
64
+ <td><%if transaction.kind == "Saida"%><font color="red">-</font><%else%><font color="blue">+</font><%end%><%=transaction.ammount%></td>
65
+ <td><%=number_to_currency(average_cost(transaction.unit_cost,transaction.ammount),:precision=>2)%></td>
66
+ <td><%=transaction.transaction_type.name unless transaction.transaction_type.nil?%></td>
67
+ </tr>
68
+
69
+ <%end%>
70
+ </table>
71
+ </div>
72
+
73
+
74
+
75
+
76
+
@@ -0,0 +1,52 @@
1
+ <style type="text/css">
2
+ <%= Rails.application.assets.find_asset('bootstrap_and_overrides.css.less').to_s.html_safe %>
3
+ </style>
4
+ <center><h3>Lista Estoque Atual</h3></center>
5
+ <div class="table-responsive">
6
+ <table class="table table-condesed">
7
+ <thead>
8
+ <tr>
9
+ <th>Nome</th>
10
+ <th>SKU</th>
11
+ <th>Localização</th>
12
+ <th>Área</th>
13
+ <th>Fabricante</th>
14
+ <th>EM</th>
15
+ <th>EA</th>
16
+ </tr>
17
+ </thead>
18
+
19
+ <tbody>
20
+ <% @products.each do |product| %>
21
+ <%if product.minimum_stock_count.present?%>
22
+ <%if product.ammount < product.minimum_stock_count%>
23
+ <tr class="danger">
24
+ <%else%>
25
+ <tr>
26
+ <%end%>
27
+ <%else%>
28
+ <%if product.ammount < Inventorymaster::Setting.find(1).minimum_stock_count%>
29
+ <tr class="danger">
30
+ <%else%>
31
+ <tr>
32
+ <%end%>
33
+ <%end%>
34
+
35
+ <td><%= product.name.upcase %></td>
36
+ <td><%if product.sku.present?%><%= product.sku %><%else%>-<%end%></td>
37
+ <td><%= product.location.name unless product.location.nil? %></td>
38
+ <td><%= product.area.name unless product.area.nil? %></td>
39
+ <td><%= product.manufacturer.name unless product.manufacturer.nil?%></td>
40
+ <td><span class="label label-warning"><%= product.minimum_stock_count %></span></td>
41
+ <td><span class="label label-primary"><%= product.ammount %></span></td>
42
+
43
+ </tr>
44
+ <% end %>
45
+ </tbody>
46
+ </table>
47
+ </div>
48
+ <br>
49
+ <br>
50
+ <span class="label label-warning">EM - Estoque Mínimo</span>
51
+ <span class="label label-primary">EA - Estoque Atual</span>
52
+ <span class="label label-info">Stock Keeping Unit (SKU) - Unidade de Manutenção de Estoque</span>
@@ -0,0 +1,84 @@
1
+ <span class="glyphicon glyphicon-search" aria-hidden="true"></span>
2
+
3
+ <div class="panel-group" id="accordion">
4
+ <div class="panel panel-default">
5
+ <div class="panel-heading">
6
+ <h4 class="panel-title">
7
+ <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
8
+ Lista Atual do Estoque #1
9
+ </a><span class="glyphicon glyphicon-triangle-right" aria-hidden="true"></span>
10
+ </h4>
11
+ </div>
12
+ <div id="collapseOne" class="panel-collapse collapse in">
13
+ <div class="panel-body">
14
+ <%=form_tag(current_stock_list_path,:method=>"get") do%>
15
+ <%=hidden_field_tag 'format','pdf'%>
16
+
17
+ <%=select_tag "location", options_for_select(@locations.collect{ |u| [u.name, u.id] }),:prompt=>"Todas"%>
18
+ <%=select_tag "area", options_for_select(@areas.collect{ |u| [u.name, u.id] }),:prompt=>"Todas"%>
19
+ <%=select_tag "manufacturer", options_for_select(@manufacturers.collect{ |u| [u.name, u.id] }),:prompt=>"Todas"%>
20
+ <%=submit_tag"Gerar Relatório",:class=>"btn btn-primary"%>
21
+ <%end%>
22
+
23
+ </div>
24
+ </div>
25
+ </div>
26
+ <div class="panel panel-default">
27
+ <div class="panel-heading">
28
+ <h4 class="panel-title">
29
+ <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
30
+ Movimentaçõs por Mês #2
31
+ </a><span class="glyphicon glyphicon-triangle-right" aria-hidden="true"></span>
32
+ </h4>
33
+ </div>
34
+ <div id="collapseTwo" class="panel-collapse collapse">
35
+ <div class="panel-body">
36
+ <%=form_tag(moviments_by_months_path,:method=>"get") do%>
37
+ <%=hidden_field_tag 'format','pdf'%>
38
+
39
+ <%=submit_tag"Gerar Relatório",:class=>"btn btn-primary"%>
40
+ <%end%>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ <div class="panel panel-default">
45
+ <div class="panel-heading">
46
+ <h4 class="panel-title">
47
+ <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
48
+ Items com Estoque Baixo #3
49
+ </a><span class="glyphicon glyphicon-triangle-right" aria-hidden="true"></span>
50
+ </h4>
51
+ </div>
52
+ <div id="collapseThree" class="panel-collapse collapse">
53
+ <div class="panel-body">
54
+ <%=form_tag(low_stock_list_path,:method=>"get") do%>
55
+ <%=hidden_field_tag 'format','pdf'%>
56
+ <%=select_tag "location", options_for_select(@locations.collect{ |u| [u.name, u.id] }),:prompt=>"Todas"%>
57
+ <%=select_tag "area", options_for_select(@areas.collect{ |u| [u.name, u.id] }),:prompt=>"Todas"%>
58
+ <%=select_tag "manufacturer", options_for_select(@manufacturers.collect{ |u| [u.name, u.id] }),:prompt=>"Todas"%>
59
+ <%=submit_tag"Gerar Relatório",:class=>"btn btn-primary"%>
60
+ <%end%>
61
+ </div>
62
+ </div>
63
+ </div>
64
+ <div class="panel panel-default">
65
+ <div class="panel-heading">
66
+ <h4 class="panel-title">
67
+ <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseFour">
68
+ Items sem Estoque#4
69
+ </a><span class="glyphicon glyphicon-triangle-right" aria-hidden="true"></span>
70
+ </h4>
71
+ </div>
72
+ <div id="collapseFour" class="panel-collapse collapse">
73
+ <div class="panel-body">
74
+ <%=form_tag(out_stock_list_path,:method=>"get") do%>
75
+ <%=hidden_field_tag 'format','pdf'%>
76
+ <%=select_tag "location", options_for_select(@locations.collect{ |u| [u.name, u.id] }),:prompt=>"Todas"%>
77
+ <%=select_tag "area", options_for_select(@areas.collect{ |u| [u.name, u.id] }),:prompt=>"Todas"%>
78
+ <%=select_tag "manufacturer", options_for_select(@manufacturers.collect{ |u| [u.name, u.id] }),:prompt=>"Todas"%>
79
+ <%=submit_tag"Gerar Relatório",:class=>"btn btn-primary"%>
80
+ <%end%>
81
+ </div>
82
+ </div>
83
+ </div>
84
+ </div>
@@ -0,0 +1,52 @@
1
+ <style type="text/css">
2
+ <%= Rails.application.assets.find_asset('bootstrap_and_overrides.css.less').to_s.html_safe %>
3
+ </style>
4
+ <center><h3>Items com estoque Baixo</h3></center>
5
+ <div class="table-responsive">
6
+ <table class="table table-condesed">
7
+ <thead>
8
+ <tr>
9
+ <th>Nome</th>
10
+ <th>SKU</th>
11
+ <th>Localização</th>
12
+ <th>Área</th>
13
+ <th>Fabricante</th>
14
+ <th>EM</th>
15
+ <th>EA</th>
16
+ </tr>
17
+ </thead>
18
+
19
+ <tbody>
20
+ <% @products.each do |product| %>
21
+ <%if product.minimum_stock_count.present?%>
22
+ <%if product.ammount < product.minimum_stock_count%>
23
+ <tr class="danger">
24
+ <%else%>
25
+ <tr>
26
+ <%end%>
27
+ <%else%>
28
+ <%if product.ammount < Inventorymaster::Setting.find(1).minimum_stock_count%>
29
+ <tr class="danger">
30
+ <%else%>
31
+ <tr>
32
+ <%end%>
33
+ <%end%>
34
+
35
+ <td><%= product.name.upcase %></td>
36
+ <td><%if product.sku.present?%><%= product.sku %><%else%>-<%end%></td>
37
+ <td><%= product.location.name unless product.location.nil? %></td>
38
+ <td><%= product.area.name unless product.area.nil? %></td>
39
+ <td><%= product.manufacturer.name unless product.manufacturer.nil?%></td>
40
+ <td><span class="label label-warning"><%= product.minimum_stock_count %></span></td>
41
+ <td><span class="label label-primary"><%= product.ammount %></span></td>
42
+
43
+ </tr>
44
+ <% end %>
45
+ </tbody>
46
+ </table>
47
+ </div>
48
+ <br>
49
+ <br>
50
+ <span class="label label-warning">EM - Estoque Mínimo</span>
51
+ <span class="label label-primary">EA - Estoque Atual</span>
52
+ <span class="label label-info">Stock Keeping Unit (SKU) - Unidade de Manutenção de Estoque</span>
@@ -0,0 +1,38 @@
1
+ <style type="text/css">
2
+ <%= Rails.application.assets.find_asset('bootstrap_and_overrides.css.less').to_s.html_safe %>
3
+ </style>
4
+ <%@average=0%>
5
+ <%@cost=0%>
6
+ <center><h3>Movimentações de produtos por Meses</h3></center>
7
+
8
+ <div class="table-responsive">
9
+
10
+ <% @moviments_months.sort.each do |month, moviments| %>
11
+ <center><h2><%= month.strftime('%B') %></center>
12
+ <table class="table table-striped" style="text-align:center;">
13
+ <tr style="font-weight: bold;">
14
+ <td>Produto</td>
15
+ <td>Tipo</td>
16
+ <td>Data</td>
17
+ <td>Usuário</td>
18
+ <td>Custo Unitário</td>
19
+ <td>Valor de Venda</td>
20
+ <td>QTD</td>
21
+ <td>Custo Médio</td>
22
+ </tr>
23
+ <% for moviment in moviments %>
24
+ <tr>
25
+ <td><%=moviment.product.name%></td>
26
+ <td><%=moviment.kind%></td>
27
+ <td><%=moviment.date.strftime("%d/%m/%Y")%></td>
28
+ <td><%if moviment.user.present?%><%=moviment.user.first_name %><%else%><center>-</center><%end%></td>
29
+ <td><%if moviment.unit_cost.present?%><%=number_to_currency(moviment.unit_cost,:precision=>2)%><%else%><center>-</center><%end%></td>
30
+ <td><%if moviment.unit_sale.present?%><%=number_to_currency(moviment.unit_sale,:precision=>2)%><%else%><center>-</center><%end%></td>
31
+ <td><%if moviment.kind == "Saida"%><font color="red">-</font><%else%><font color="blue">+</font><%end%><%=moviment.ammount%></td>
32
+ <td><%=number_to_currency(average_cost(moviment.unit_cost,moviment.ammount),:precision=>2)%></td>
33
+ </tr>
34
+ <% end %>
35
+ </table>
36
+ <% end %>
37
+ </table>
38
+ </div>
@@ -0,0 +1,52 @@
1
+ <style type="text/css">
2
+ <%= Rails.application.assets.find_asset('bootstrap_and_overrides.css.less').to_s.html_safe %>
3
+ </style>
4
+ <center><h3>Lista Estoque Atual</h3></center>
5
+ <div class="table-responsive">
6
+ <table class="table table-condesed">
7
+ <thead>
8
+ <tr>
9
+ <th>Nome</th>
10
+ <th>SKU</th>
11
+ <th>Localização</th>
12
+ <th>Área</th>
13
+ <th>Fabricante</th>
14
+ <th>EM</th>
15
+ <th>EA</th>
16
+ </tr>
17
+ </thead>
18
+
19
+ <tbody>
20
+ <% @products.each do |product| %>
21
+ <%if product.minimum_stock_count.present?%>
22
+ <%if product.ammount < product.minimum_stock_count%>
23
+ <tr class="danger">
24
+ <%else%>
25
+ <tr>
26
+ <%end%>
27
+ <%else%>
28
+ <%if product.ammount < Inventorymaster::Setting.find(1).minimum_stock_count%>
29
+ <tr class="danger">
30
+ <%else%>
31
+ <tr>
32
+ <%end%>
33
+ <%end%>
34
+
35
+ <td><%= product.name.upcase %></td>
36
+ <td><%if product.sku.present?%><%= product.sku %><%else%>-<%end%></td>
37
+ <td><%= product.location.name unless product.location.nil? %></td>
38
+ <td><%= product.area.name unless product.area.nil? %></td>
39
+ <td><%= product.manufacturer.name unless product.manufacturer.nil?%></td>
40
+ <td><span class="label label-warning"><%= product.minimum_stock_count %></span></td>
41
+ <td><span class="label label-primary"><%= product.ammount %></span></td>
42
+
43
+ </tr>
44
+ <% end %>
45
+ </tbody>
46
+ </table>
47
+ </div>
48
+ <br>
49
+ <br>
50
+ <span class="label label-warning">EM - Estoque Mínimo</span>
51
+ <span class="label label-primary">EA - Estoque Atual</span>
52
+ <span class="label label-info">Stock Keeping Unit (SKU) - Unidade de Manutenção de Estoque</span>
@@ -3,7 +3,7 @@
3
3
  </div>
4
4
  <div align="right"><%= link_to 'Inserir Tipo de Transação', new_transaction_type_path ,:class=>"btn btn-primary"%></div>
5
5
  <br>
6
-
6
+ <div class="table-responsive">
7
7
  <table class="table table-condesed">
8
8
 
9
9
  <thead>
@@ -24,6 +24,6 @@
24
24
  <% end %>
25
25
  </tbody>
26
26
  </table>
27
-
27
+ </div>
28
28
  <br>
29
29
 
@@ -42,7 +42,7 @@
42
42
  </div>
43
43
  <div class="field">
44
44
  <%= f.label :ammount ,"Quantidade"%><br>
45
- <%= f.number_field :ammount %>
45
+ <%= f.number_field :ammount ,:required=>true%>
46
46
  </div>
47
47
 
48
48
  <div class="field">
@@ -55,7 +55,7 @@
55
55
  </div>
56
56
  <div class="field">
57
57
  <%= f.label :transaction_type_id ,"Tipo da Transação"%><br>
58
- <%= f.select :transaction_type_id , @transactiontypes.collect { |c| [ c.name, c.id ] },:prompt => 'Selecione um tipo ' %>
58
+ <%= f.select :transaction_type_id , @transactiontypes.collect { |c| [ c.name, c.id ] },{ :include_blank => '-- Selecione um Tipo --' }, :required => true %>
59
59
  </div>
60
60
  <br>
61
61
  <div class="actions">
data/config/routes.rb CHANGED
@@ -1,4 +1,13 @@
1
1
  Inventorymaster::Engine.routes.draw do
2
+
3
+ resources :reports
4
+ get 'current_stock_list',:controller=>'reports',:action=>'current_stock_list'
5
+ get 'moviments_by_months',:controller=>'reports',:action=>'moviments_by_months'
6
+ get 'low_stock_list',:controller=>'reports',:action=>'low_stock_list'
7
+ get 'out_stock_list',:controller=>'reports',:action=>'out_stock_list'
8
+
9
+
10
+
2
11
  resources :transaction_types
3
12
  resources :transactions do
4
13
  get ':transactions/:id', to: 'transactions#new', on: :member
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inventorymaster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jcottobboni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-29 00:00:00.000000000 Z
11
+ date: 2015-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -98,6 +98,7 @@ files:
98
98
  - app/controllers/inventorymaster/locations_controller.rb
99
99
  - app/controllers/inventorymaster/manufacturers_controller.rb
100
100
  - app/controllers/inventorymaster/products_controller.rb
101
+ - app/controllers/inventorymaster/reports_controller.rb
101
102
  - app/controllers/inventorymaster/settings_controller.rb
102
103
  - app/controllers/inventorymaster/transaction_types_controller.rb
103
104
  - app/controllers/inventorymaster/transactions_controller.rb
@@ -106,6 +107,7 @@ files:
106
107
  - app/helpers/inventorymaster/locations_helper.rb
107
108
  - app/helpers/inventorymaster/manufacturers_helper.rb
108
109
  - app/helpers/inventorymaster/products_helper.rb
110
+ - app/helpers/inventorymaster/reports_helper.rb
109
111
  - app/helpers/inventorymaster/settings_helper.rb
110
112
  - app/helpers/inventorymaster/transaction_types_helper.rb
111
113
  - app/helpers/inventorymaster/transactions_helper.rb
@@ -136,6 +138,12 @@ files:
136
138
  - app/views/inventorymaster/products/index.html.erb
137
139
  - app/views/inventorymaster/products/new.html.erb
138
140
  - app/views/inventorymaster/products/show.html.erb
141
+ - app/views/inventorymaster/products/show.pdf.erb
142
+ - app/views/inventorymaster/reports/current_stock_list.pdf.erb
143
+ - app/views/inventorymaster/reports/index.html.erb
144
+ - app/views/inventorymaster/reports/low_stock_list.pdf.erb
145
+ - app/views/inventorymaster/reports/moviments_by_months.pdf.erb
146
+ - app/views/inventorymaster/reports/out_stock_list.pdf.erb
139
147
  - app/views/inventorymaster/settings/_form.html.erb
140
148
  - app/views/inventorymaster/settings/edit.html.erb
141
149
  - app/views/inventorymaster/settings/index.html.erb
@@ -247,66 +255,66 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
255
  version: '0'
248
256
  requirements: []
249
257
  rubyforge_project:
250
- rubygems_version: 2.4.1
258
+ rubygems_version: 2.4.6
251
259
  signing_key:
252
260
  specification_version: 4
253
261
  summary: Inventory system engine
254
262
  test_files:
255
- - test/integration/navigation_test.rb
256
- - test/dummy/public/404.html
257
- - test/dummy/public/500.html
258
- - test/dummy/public/422.html
259
- - test/dummy/public/favicon.ico
260
- - test/dummy/app/assets/stylesheets/application.css
263
+ - test/controllers/inventorymaster/areas_controller_test.rb
264
+ - test/controllers/inventorymaster/locations_controller_test.rb
265
+ - test/controllers/inventorymaster/manufacturers_controller_test.rb
266
+ - test/controllers/inventorymaster/products_controller_test.rb
267
+ - test/controllers/inventorymaster/settings_controller_test.rb
268
+ - test/controllers/inventorymaster/transaction_types_controller_test.rb
269
+ - test/controllers/inventorymaster/transactions_controller_test.rb
261
270
  - test/dummy/app/assets/javascripts/application.js
271
+ - test/dummy/app/assets/stylesheets/application.css
262
272
  - test/dummy/app/controllers/application_controller.rb
263
273
  - test/dummy/app/helpers/application_helper.rb
264
274
  - test/dummy/app/views/layouts/application.html.erb
265
- - test/dummy/Rakefile
266
- - test/dummy/bin/rake
275
+ - test/dummy/bin/bundle
267
276
  - test/dummy/bin/rails
277
+ - test/dummy/bin/rake
268
278
  - test/dummy/bin/setup
269
- - test/dummy/bin/bundle
270
- - test/dummy/config/locales/en.yml
279
+ - test/dummy/config/application.rb
280
+ - test/dummy/config/boot.rb
281
+ - test/dummy/config/database.yml
271
282
  - test/dummy/config/environment.rb
283
+ - test/dummy/config/environments/development.rb
272
284
  - test/dummy/config/environments/production.rb
273
285
  - test/dummy/config/environments/test.rb
274
- - test/dummy/config/environments/development.rb
275
- - test/dummy/config/application.rb
276
- - test/dummy/config/secrets.yml
277
- - test/dummy/config/initializers/wrap_parameters.rb
278
- - test/dummy/config/initializers/mime_types.rb
279
- - test/dummy/config/initializers/session_store.rb
280
286
  - test/dummy/config/initializers/assets.rb
281
287
  - test/dummy/config/initializers/backtrace_silencers.rb
282
- - test/dummy/config/initializers/inflections.rb
283
- - test/dummy/config/initializers/filter_parameter_logging.rb
284
288
  - test/dummy/config/initializers/cookies_serializer.rb
289
+ - test/dummy/config/initializers/filter_parameter_logging.rb
290
+ - test/dummy/config/initializers/inflections.rb
291
+ - test/dummy/config/initializers/mime_types.rb
292
+ - test/dummy/config/initializers/session_store.rb
293
+ - test/dummy/config/initializers/wrap_parameters.rb
294
+ - test/dummy/config/locales/en.yml
285
295
  - test/dummy/config/routes.rb
286
- - test/dummy/config/boot.rb
287
- - test/dummy/config/database.yml
288
- - test/dummy/README.rdoc
296
+ - test/dummy/config/secrets.yml
289
297
  - test/dummy/config.ru
290
- - test/fixtures/inventorymaster/locations.yml
291
- - test/fixtures/inventorymaster/transactions.yml
292
- - test/fixtures/inventorymaster/settings.yml
298
+ - test/dummy/public/404.html
299
+ - test/dummy/public/422.html
300
+ - test/dummy/public/500.html
301
+ - test/dummy/public/favicon.ico
302
+ - test/dummy/Rakefile
303
+ - test/dummy/README.rdoc
293
304
  - test/fixtures/inventorymaster/areas.yml
305
+ - test/fixtures/inventorymaster/locations.yml
306
+ - test/fixtures/inventorymaster/manufacturers.yml
294
307
  - test/fixtures/inventorymaster/products.yml
308
+ - test/fixtures/inventorymaster/settings.yml
295
309
  - test/fixtures/inventorymaster/transaction_types.yml
296
- - test/fixtures/inventorymaster/manufacturers.yml
297
- - test/controllers/inventorymaster/locations_controller_test.rb
298
- - test/controllers/inventorymaster/settings_controller_test.rb
299
- - test/controllers/inventorymaster/areas_controller_test.rb
300
- - test/controllers/inventorymaster/transactions_controller_test.rb
301
- - test/controllers/inventorymaster/manufacturers_controller_test.rb
302
- - test/controllers/inventorymaster/products_controller_test.rb
303
- - test/controllers/inventorymaster/transaction_types_controller_test.rb
310
+ - test/fixtures/inventorymaster/transactions.yml
311
+ - test/integration/navigation_test.rb
304
312
  - test/inventorymaster_test.rb
305
- - test/models/inventorymaster/transaction_type_test.rb
306
313
  - test/models/inventorymaster/area_test.rb
314
+ - test/models/inventorymaster/location_test.rb
315
+ - test/models/inventorymaster/manufacturer_test.rb
307
316
  - test/models/inventorymaster/product_test.rb
308
317
  - test/models/inventorymaster/setting_test.rb
309
- - test/models/inventorymaster/manufacturer_test.rb
310
318
  - test/models/inventorymaster/transaction_test.rb
311
- - test/models/inventorymaster/location_test.rb
319
+ - test/models/inventorymaster/transaction_type_test.rb
312
320
  - test/test_helper.rb