├── app ├── helpers │ └── inventory_helper.rb ├── models │ ├── inventory_warehouse.rb │ ├── inventory_category.rb │ ├── inventory_part.rb │ ├── inventory_providor.rb │ └── inventory_movement.rb ├── views │ ├── settings │ │ └── _rim_settings.erb │ └── inventory │ │ ├── reports.erb │ │ ├── _category_form.html.erb │ │ ├── _warehouse_form.html.erb │ │ ├── categories.html.erb │ │ ├── _part_form.html.erb │ │ ├── warehouses.html.erb │ │ ├── _top_menu.html.erb │ │ ├── providors.html.erb │ │ ├── parts.html.erb │ │ ├── _providor_form.html.erb │ │ ├── _movement_out_form.html.erb │ │ ├── _movement_in_form.html.erb │ │ ├── movements.html.erb │ │ └── index.html.erb └── controllers │ └── inventory_controller.rb ├── test ├── test_helper.rb ├── fixtures │ ├── inventory_categories.yml │ ├── inventory_warehouses.yml │ ├── inventory_parts.yml │ ├── inventory_movements.yml │ └── inventory_providors.yml ├── functional │ └── inventory_controller_test.rb └── unit │ ├── inventory_part_test.rb │ ├── inventory_category_test.rb │ ├── inventory_movement_test.rb │ ├── inventory_providor_test.rb │ └── inventory_warehouse_test.rb ├── db └── migrate │ ├── 008_modifications_for_permission.rb │ ├── 004_create_inventory_categories.rb │ ├── 006_create_inventory_warehouses.rb │ ├── 001_create_inventory_parts.rb │ ├── 002_create_inventory_movements.rb │ ├── 003_create_inventory_providors.rb │ ├── 005_foreign_keys_and_views.rb │ └── 007_keys_and_modifications.rb ├── assets └── stylesheets │ └── inventory.css ├── init.rb ├── config ├── routes.rb └── locales │ ├── en.yml │ └── es.yml └── README.rdoc /app/helpers/inventory_helper.rb: -------------------------------------------------------------------------------- 1 | module InventoryHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/models/inventory_warehouse.rb: -------------------------------------------------------------------------------- 1 | class InventoryWarehouse < ActiveRecord::Base 2 | end 3 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | # Load the Redmine helper 2 | require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper') 3 | -------------------------------------------------------------------------------- /test/fixtures/inventory_categories.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 2 | one: 3 | id: 1 4 | name: MyString 5 | descriptrion: 6 | two: 7 | id: 2 8 | name: MyString 9 | descriptrion: 10 | -------------------------------------------------------------------------------- /app/models/inventory_category.rb: -------------------------------------------------------------------------------- 1 | class InventoryCategory < ActiveRecord::Base 2 | #t.column :name, :string 3 | #t.column :description, :text 4 | 5 | has_many :inventory_parts 6 | 7 | validates_presence_of :name 8 | 9 | end 10 | -------------------------------------------------------------------------------- /test/fixtures/inventory_warehouses.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 2 | one: 3 | id: 1 4 | name: MyString 5 | location: MyString 6 | two: 7 | id: 2 8 | name: MyString 9 | location: MyString 10 | -------------------------------------------------------------------------------- /test/functional/inventory_controller_test.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../test_helper' 2 | 3 | class InventoryControllerTest < ActionController::TestCase 4 | # Replace this with your real tests. 5 | def test_truth 6 | assert true 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /test/unit/inventory_part_test.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../test_helper' 2 | 3 | class InventoryPartTest < Test::Unit::TestCase 4 | fixtures :inventory_parts 5 | 6 | # Replace this with your real tests. 7 | def test_truth 8 | assert true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /test/unit/inventory_category_test.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../test_helper' 2 | 3 | class InventoryCategoryTest < Test::Unit::TestCase 4 | fixtures :inventory_categories 5 | 6 | # Replace this with your real tests. 7 | def test_truth 8 | assert true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /test/unit/inventory_movement_test.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../test_helper' 2 | 3 | class InventoryMovementTest < Test::Unit::TestCase 4 | fixtures :inventory_movements 5 | 6 | # Replace this with your real tests. 7 | def test_truth 8 | assert true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /test/unit/inventory_providor_test.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../test_helper' 2 | 3 | class InventoryProvidorTest < Test::Unit::TestCase 4 | fixtures :inventory_providors 5 | 6 | # Replace this with your real tests. 7 | def test_truth 8 | assert true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /test/unit/inventory_warehouse_test.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/../test_helper' 2 | 3 | class InventoryWarehouseTest < Test::Unit::TestCase 4 | fixtures :inventory_warehouses 5 | 6 | # Replace this with your real tests. 7 | def test_truth 8 | assert true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/views/settings/_rim_settings.erb: -------------------------------------------------------------------------------- 1 |
| Hide Donate Add | 5 |> 7 | |
|---|
8 | ' onclick="location.href='/inventory/report_export/input_invoice?warehouse='+$('#warehouse').val()" /> 9 |
-------------------------------------------------------------------------------- /test/fixtures/inventory_providors.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html 2 | one: 3 | id: 1 4 | identification: 5 | name: 6 | address0: 7 | address1: 8 | city: 9 | state: 10 | country: 11 | phone0: 12 | phone1: 13 | fax: 14 | business: 15 | email: 16 | contact0: 17 | contact1: MyString 18 | two: 19 | id: 2 20 | identification: 21 | name: 22 | address0: 23 | address1: 24 | city: 25 | state: 26 | country: 27 | phone0: 28 | phone1: 29 | fax: 30 | business: 31 | email: 32 | contact0: 33 | contact1: MyString 34 | -------------------------------------------------------------------------------- /app/models/inventory_providor.rb: -------------------------------------------------------------------------------- 1 | class InventoryProvidor < ActiveRecord::Base 2 | #t.column :identification, :string 3 | #t.column :name, :string 4 | #t.column :address0, :string 5 | #t.column :address1, :string 6 | #t.column :city, :string 7 | #t.column :state, :string 8 | #t.column :country, :string 9 | #t.column :phone0, :string 10 | #t.column :phone1, :string 11 | #t.column :fax, :string 12 | #t.column :business, :string 13 | #t.column :email, :string 14 | #t.column :contact0, :string 15 | #t.column :contact1, :string 16 | 17 | validates_presence_of :identification, :name 18 | 19 | 20 | end 21 | -------------------------------------------------------------------------------- /db/migrate/002_create_inventory_movements.rb: -------------------------------------------------------------------------------- 1 | class CreateInventoryMovements < ActiveRecord::Migration[5.1] 2 | def self.up 3 | create_table :inventory_movements do |t| 4 | t.column :inventory_part_id, :integer 5 | t.column :quantity, :float 6 | t.column :document, :string 7 | t.column :document_type, :integer 8 | t.column :value, :float 9 | t.column :inventory_providor_id, :integer 10 | t.column :project_id, :string 11 | t.column :other_destiny, :string 12 | t.column :date, :datetime 13 | t.column :user_id, :integer 14 | end 15 | end 16 | 17 | def self.down 18 | drop_table :inventory_movements 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /init.rb: -------------------------------------------------------------------------------- 1 | Redmine::Plugin.register :redmine_inventory_manager do 2 | name 'Redmine Inventory Manager Plugin' 3 | author 'Daniel Anguita O.' 4 | description 'Take your warehouse or office inventory on the same platform of your projects' 5 | version '0.9' 6 | url 'https://github.com/danielanguita/Redmine-Inventory-Manager' 7 | 8 | permission :inventory, {:inventory => [:index, :movements, :categories, :parts, :warehouses, :providors]}, :public => false 9 | 10 | menu :top_menu, :inventory, { :controller => 'inventory', :action => 'index' }, { :caption => 'Inventory', :before => 'admin'} 11 | 12 | settings :default => {'empty' => true}, :partial => 'settings/rim_settings' 13 | end 14 | 15 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | # Plugin's routes 2 | # See: http://guides.rubyonrails.org/routing.html 3 | get 'inventory', to: 'inventory#index' 4 | 5 | get 'inventory(/:action(/:id))', controller: :inventory 6 | post 'inventory(/:action(/:id))', controller: :inventory 7 | put 'inventory(/:action(/:id))', controller: :inventory 8 | 9 | get 'inventory(/categories:action(/:id))', controller: :inventory 10 | post 'inventory(/categories:action(/:id))', controller: :inventory 11 | put 'inventory(/categories:action(/:id))', controller: :inventory 12 | 13 | get 'inventory(/parts:action(/:id))', controller: :inventory 14 | post 'inventory(/parts:action(/:id))', controller: :inventory 15 | put 'inventory(/parts:action(/:id))', controller: :inventory 16 | -------------------------------------------------------------------------------- /db/migrate/003_create_inventory_providors.rb: -------------------------------------------------------------------------------- 1 | class CreateInventoryProvidors < ActiveRecord::Migration[5.1] 2 | def self.up 3 | create_table :inventory_providors do |t| 4 | t.column :identification, :string 5 | t.column :name, :string 6 | t.column :address0, :string 7 | t.column :address1, :string 8 | t.column :city, :string 9 | t.column :state, :string 10 | t.column :country, :string 11 | t.column :phone0, :string 12 | t.column :phone1, :string 13 | t.column :fax, :string 14 | t.column :business, :string 15 | t.column :email, :string 16 | t.column :contact0, :string 17 | t.column :contact1, :string 18 | end 19 | end 20 | 21 | def self.down 22 | drop_table :inventory_providors 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /app/views/inventory/_category_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= labelled_form_for :inventory_category, @inventory_category, 2 | :url => {:action => 'categories', :id => @inventory_category}, 3 | :html => {:id => 'category-form'} do |f| %> 4 | <%= error_messages_for 'inventory_category' %> 5 |
6 | <%= f.text_field :name, :size => 15, :required => true %>
7 |
<%= f.text_field :description, :size => 100 %>
8 | <% if params[:edit] %>
9 | <% else %><% end %>
10 |
12 | <%= submit_tag l(:button_submit) %> 13 | <% if params[:edit] %>' onclick='location.href="categories"' /><% end %> 14 |
15 | <% end %> -------------------------------------------------------------------------------- /app/views/inventory/_warehouse_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= labelled_form_for :inventory_warehouse, @inventory_warehouse, 2 | :url => {:action => 'warehouses', :id => @inventory_warehouse}, 3 | :html => {:id => 'warehouse-form'} do |f| %> 4 | <%= error_messages_for 'inventory_warehouse' %> 5 |
6 | <%= f.text_field :name, :size => 15, :required => true %>
7 |
<%= f.text_field :location, :size => 100 %>
8 |
<%= f.select :user_manager_id, @users %>
9 | <% if params[:edit] %>
10 | <% else %><% end %>
11 |
13 | <%= submit_tag l(:button_submit) %> 14 | <% if params[:edit] %>' onclick='location.href="warehouses"' /><% end %> 15 |
16 | <% end %> -------------------------------------------------------------------------------- /README.rdoc: -------------------------------------------------------------------------------- 1 | #### THIS PLUG IS IN DEVELOPMENT. IF YOU NEED ANY FUNCTIONALITY RELATED TO THIS PLUGIN ADD IT IN THE ISSUES 2 | 3 | 4 | *Description* 5 | Take your warehouse or office inventory on the same platform of your projects. 6 | If you want a feature you can add issue. 7 | 8 | *Instalation* 9 | 1.- Install Redmine (http://www.redmine.org/wiki/1/RedmineInstall) 10 | 2.- Get the plugin and install 11 | $> cd #{RAILS_ROOT}/plugins 12 | $> git clone https://github.com/danielanguita/redmine_inventory_manager 13 | $> cd .. 14 | $> rake redmine:plugins:migrate RAILS_ENV=production 15 | 3.- Start your server and enjoy! :D 16 | 17 | *Notes* 18 | - upgraded to support redmine 5.1 19 | - Only two languages supportes for now (spanish and english) 20 | 21 | *Contributors* 22 | - Daniel Anguita @danielanguita 23 | - Imanol Alvarez @w0www 24 | - bluenevus @bluenevus 25 | - Emiliano Baum @emilianobaum 26 | 27 | Agrego a db/migrate y a controllers [5.1] para la version de redmine en uso. -------------------------------------------------------------------------------- /app/models/inventory_movement.rb: -------------------------------------------------------------------------------- 1 | class InventoryMovement < ActiveRecord::Base 2 | #t.column :inventory_part_id, :integer 3 | #t.column :quantity, :float 4 | #t.column :document, :string 5 | #t.column :document_type, :integer 6 | #t.column :value, :float 7 | #t.column :inventory_providor_id, :integer 8 | #t.column :project_id, :integer 9 | #t.column :another_destiny :string 10 | #t.column :date, :datetime 11 | #t.column :user_id, :integer 12 | 13 | belongs_to :inventory_part 14 | belongs_to :inventory_providor 15 | belongs_to :user 16 | belongs_to :project 17 | 18 | validates_presence_of :inventory_part, :quantity, :date, :user_id 19 | 20 | def doctype 21 | doc_types = { 22 | 1 => l('invoice'), 23 | 2 => l('ticket'), 24 | 3 => l('proforma-invoice'), 25 | 4 => l("waybill"), 26 | 5 => l("inventory") 27 | } 28 | if self.document_type 29 | return doc_types[document_type] 30 | end 31 | return nil 32 | end 33 | 34 | 35 | end 36 | -------------------------------------------------------------------------------- /app/views/inventory/categories.html.erb: -------------------------------------------------------------------------------- 1 | <%= render :partial => 'top_menu' %> 2 || Id# | <%= l('field_name') %> | <%= l('field_description') %> | ||
|---|---|---|---|---|
| <%= c.id %> | <%= c.name %> | <%= c.description %> | 19 | <% if @has_permission %> 20 |<%= link_to image_tag('edit.png'), 'categories?edit='+c.id.to_s %> | 21 |<%= link_to image_tag('delete.png'), 'categories?delete='+c.id.to_s, :confirm => l('delete_confirmation') %> | 22 | <% end %> 23 |
6 | <%= f.text_field :part_number, :size => 20, :required => true %>
7 |
<%= f.text_field :manufacturer, :size => 30, :required => true %>
8 |
<%= f.select(:inventory_category_id, @categories, {:include_blank => false}) %>
9 |
<%= f.text_field :description, :size => 30 %>
10 |
<%= f.text_field :where, :size => 30 %>
11 |
<%= f.text_field :value, :size => 6 %>
12 |
<%= f.select(:status, @statuses) %>
13 | <% if params[:edit] %>
14 | <% else %><% end %>
15 |
17 | <%= submit_tag l(:button_submit) %> 18 | <% if params[:edit] %>' onclick='location.href="parts"' /><% end %> 19 |
20 | <% end %> -------------------------------------------------------------------------------- /app/views/inventory/warehouses.html.erb: -------------------------------------------------------------------------------- 1 | <%= render :partial => 'top_menu' %> 2 || Id# | <%= l('field_name') %> | <%= l('field_location') %> | <%= l('field_user_manager') %> | ||
|---|---|---|---|---|---|
| <%= w.id %> | <%= w.name %> | <%= w.location %> | <%= User.find(w.user_manager_id).login rescue "s/a" %> | 19 | <% if @has_permission %> 20 |<%= link_to image_tag('edit.png'), 'warehouses?edit='+w.id.to_s %> | 21 |<%= link_to image_tag('delete.png'), 'warehouses?delete='+w.id.to_s, :confirm => l('delete_confirmation') %> | 22 | <% end %> 23 |
| Id# | <%= l('field_identification') %> | <%= l('field_name') %> | <%= l('field_address0') %> | <%= l('field_phone0') %> | ||
|---|---|---|---|---|---|---|
| <%= p.id %> | <%= p.identification %> | <%= p.name %> | 19 |<%= p.address0 %>, <%= p.address1 %>, <%= p.city %> | 20 |<%= p.phone0 %> - <%= p.phone1 %> | 21 | <% if @has_permission %> 22 |<%= link_to image_tag('edit.png'), 'providors?edit='+p.id.to_s %> | 23 |<%= link_to image_tag('delete.png'), 'providors?delete='+p.id.to_s, :confirm => l('delete_confirmation') %> | 24 | <% end %> 25 |
| Id# | <%= l('field_part_number') %> | <%= l('field_manufacturer') %> | <%= l('field_description') %> | <%= l('field_category') %> | <%= l('field_value') %> | <%= l('field_status') %> | ||
|---|---|---|---|---|---|---|---|---|
| <%= p.id %> | <%= p.part_number %> | <%= p.manufacturer %> | <%= p.description %> | 19 |<%= p.inventory_category.name %> | <%= number_to_currency(p.value) %> | 20 |<%= @statuses_array[p.status] %> | 21 | <% if @has_permission %> 22 |<%= link_to image_tag('edit.png'), 'parts?edit='+p.id.to_s %> | 23 |<%= link_to image_tag('delete.png'), 'parts?delete='+p.id.to_s, :confirm => l('delete_confirmation') %> | 24 | <% end %> 25 |
6 | <%= f.text_field :identification, :size => 20, :required => true %>
7 |
<%= f.text_field :name, :size => 30, :required => true %>
8 |
<%= f.text_field :address0, :size => 30 %>
9 |
<%= f.text_field :address1, :size => 30 %>
10 |
<%= f.text_field :city, :size => 20 %>
11 |
<%= f.text_field :state, :size => 20 %>
12 |
<%= f.text_field :country, :size => 20 %>
13 |
<%= f.text_field :phone0, :size => 10 %>
14 |
<%= f.text_field :phone1, :size => 10 %>
15 |
<%= f.text_field :fax, :size => 10 %>
16 |
<%= f.text_field :business, :size => 40 %>
17 |
<%= f.text_field :email, :size => 20 %>
18 |
<%= f.text_field :contact0, :size => 20 %>
19 |
<%= f.text_field :contact1, :size => 20 %>
20 | <% if params[:edit] %>
21 | <% else %><% end %>
22 |
24 | <%= submit_tag l(:button_submit) %> 25 | <% if params[:edit] %>' onclick='location.href="providors"' /><% end %> 26 |
27 | <% end %> -------------------------------------------------------------------------------- /app/views/inventory/_movement_out_form.html.erb: -------------------------------------------------------------------------------- 1 | 16 | <%= labelled_form_for :inventory_out_movement, @inventory_out_movement, 17 | :url => {:action => 'movements', :id => @inventory_out_movement}, 18 | :html => {:id => 'part-out-form'} do |f| %> 19 | <%= error_messages_for 'inventory_out_movement' %> 20 |
21 | <%= f.select(:warehouse_from_id, @warehouses,{:disabled => true}) %>
22 |
<%= f.select(:inventory_part_id, @parts) %>
23 |
<%= f.text_field :serial_number, :size => 8 %>
24 |
<%= f.text_field :quantity, :size => 4, :required => true %>
25 |
<%= f.select(:document_type, @doc_types) %>
26 |
<%= f.text_field :document, :size => 30 %>
27 |
28 | <%= select_tag("to_options", options_for_select(@to_options, params[:to_options]), {:onchange => 'show_to_input($("#to_options").val());'}) %>
29 |
style='display:none'<% end %>><%= f.select(:user_to_id, @users, {}, {:disabled => (params[:to_options] == 'user_to_id' ? false:true)}) %>
30 | style='display:none'<% end %>><%= f.select(:project_id, @inv_projects, {}, {:disabled => (params[:to_options] == 'project_id' ? false:true)}) %>
31 | <% if params[:edit_out] %>
32 | <% else %><% end %>
33 |
35 | <%= submit_tag l(:button_submit) %> 36 | <% if params[:edit_out] %>' onclick='location.href="movements"' /><% end %> 37 |
38 | <% end %> -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | "en": 2 | inventory: Inventory 3 | reports: Reports 4 | export: Export 5 | field_identification: ID/EIN 6 | field_name: Name 7 | field_address0: Address 8 | field_address1: Address 2 9 | field_city: City 10 | field_state: State 11 | field_country: Country 12 | field_phone0: Phone 13 | field_phone1: 2nd Phone 14 | field_fax: Fax 15 | field_business: Industry/Activity 16 | field_email: E-Mail 17 | field_contact0: Contact 18 | field_contact1: Contact 2 19 | field_inventory_category: Category 20 | field_manufacturer: Manufacturer/Branch 21 | field_part_number: Product 22 | field_inventory_part: Product 23 | field_inventory_providor: Providor 24 | field_quantity: Quantity 25 | field_squantity: Qty 26 | field_document: Document 27 | field_document_type: Document Type 28 | field_location: Location 29 | field_user_from: User 30 | field_warehouse_from: Warehouse 31 | field_user_to: User 32 | field_warehouse_to: Enter to Warehouse 33 | field_serial_number: Serial Number 34 | inventory_stock: Inventory Stock 35 | inventory_movements: Movements 36 | inventory_parts: Products 37 | inventory_categories: Categories 38 | inventory_warehouses: Warehouses 39 | inventory_providors: Providors 40 | inventory_manager: Inventory 41 | Edit: Edit 42 | Create: Create 43 | Delete: Delete 44 | Cancel: Cancel 45 | input_movements: In Movement 46 | output_movements: Out Movement 47 | User: User 48 | Project: Project 49 | Providor: Providor 50 | Warehouse: Warehouse 51 | Part: Product 52 | Category: Category 53 | all_warehouses: All Warehouses 54 | delete_confirmation: Are you sure you want to DELETE the registry? 55 | cant_delete_register: You can not delete the record. Probably should be related to anotherone 56 | out_of_stock: There is enough stock to make the out movement. 57 | field_where: Where is it kept? 58 | field_user_manager: Warehouse Manager 59 | permission_denied: You don't have permission to make changes on that Warehouse. 60 | field_short_part_number: Product 61 | From: From 62 | To: To 63 | Date: Date 64 | out_movement_list: Out Movements List 65 | in_movement_list: In Movements Lits 66 | part_comes_from: Product comes from 67 | part_goes_to: Product is delivered to 68 | inputs: Inputs 69 | outputs: Outputs 70 | stock: Stock 71 | last_movement: Last Movement 72 | total: Total 73 | inventory_value: Inventory Value 74 | invoice: Invoice 75 | proforma-invoice: Proforma Invoice 76 | waybill: Waybill 77 | ticket: Ticket 78 | active: Active 79 | obsolet: Obsolet 80 | discontinued: Discontinued 81 | inventory_inputs_document_report: In Movements w/Buying Documents 82 | -------------------------------------------------------------------------------- /config/locales/es.yml: -------------------------------------------------------------------------------- 1 | "es": 2 | inventory: Inventario 3 | reports: Informes 4 | field_identification: RUT 5 | field_name: Nombre 6 | field_address0: Dirección 7 | field_address1: Dirección 2 8 | field_city: Ciudad 9 | field_state: Comuna 10 | field_country: País 11 | field_phone0: Teléfono 12 | field_phone1: Teléfono 2 13 | field_fax: Fax 14 | field_business: Giro 15 | field_email: E-Mail 16 | field_contact0: Contacto 17 | field_contact1: Contacto 2 18 | field_inventory_category: Categoría 19 | field_manufacturer: Marca 20 | field_part_number: Producto 21 | field_inventory_part: Producto 22 | field_inventory_providor: Proveedor 23 | field_quantity: Cantidad 24 | field_squantity: Cant. 25 | field_document: Documento 26 | field_document_type: Tipo Documento 27 | field_location: Locación 28 | field_user_from: Usuario 29 | field_warehouse_from: Bodega 30 | field_user_to: Usuario 31 | field_warehouse_to: Entra a Bodega 32 | field_serial_number: Numero de Serie 33 | inventory_stock: Stock de Inventario 34 | inventory_movements: Movimientos 35 | inventory_parts: Productos 36 | inventory_categories: Categorías 37 | inventory_warehouses: Bodegas 38 | inventory_providors: Proveedores 39 | inventory_manager: Inventario 40 | Edit: Editar 41 | Create: Crear 42 | Delete: Eliminar 43 | Cancel: Cancelar 44 | input_movements: Movimiento de Entrada 45 | output_movements: Movimiento de Salida 46 | User: Usuario 47 | Project: Projecto 48 | Providor: Proveedor 49 | Warehouse: Bodega 50 | Part: Producto 51 | Category: Categoría 52 | all_warehouses: Todas las Bodegas 53 | delete_confirmation: Esta seguro que desea ELIMINAR el registro? 54 | cant_delete_register: No es posible eliminar el registro. Probablemente debe estar relacionado con otro. 55 | out_of_stock: No existe stock suficiente para realizar el movimiento de salida. 56 | field_where: ¿Donde se guarda? 57 | field_user_manager: Administrador de Bodega 58 | permission_denied: No tienes permiso para realizar cambios en esa Bodega 59 | field_short_part_number: Producto 60 | From: De 61 | To: To 62 | Date: Fecha 63 | out_movement_list: Lista de Salidas 64 | in_movement_list: Lista de Entradas 65 | part_comes_from: Producto proviene de 66 | part_goes_to: Producto se entrega a 67 | inputs: Entradas 68 | outputs: Salidas 69 | stock: Stock 70 | last_movement: Último Movimiento 71 | total: Total 72 | inventory_value: Inventario Valorizado 73 | invoice: Factura 74 | proforma-invoice: Factura Proforma 75 | waybill: Guía de Despacho 76 | ticket: Boleta 77 | active: Vigente 78 | obsolet: Obsoleto 79 | discontinued: Descontinuado 80 | export: Exportar 81 | reports: Informes 82 | inventory_inputs_document_report: Entradas c/Documentos de Compra 83 | -------------------------------------------------------------------------------- /app/views/inventory/_movement_in_form.html.erb: -------------------------------------------------------------------------------- 1 | 26 | <%= labelled_form_for :inventory_in_movement, @inventory_in_movement, 27 | :url => {:action => 'movements', :id => @inventory_in_movement}, 28 | :html => {:id => 'part-in-form'} do |f| %> 29 | <%= error_messages_for 'inventory_in_movement' %> 30 |
31 |
32 | <%= select_tag("from_options", options_for_select(@from_options, params[:from_options]), {:onchange => "show_from_input($('#from_options').val());"}) %>
33 |
style='display:none'<% end %>><%= f.select(:user_from_id, @users, {}, {:disabled => (params[:from_options] == 'user_from_id' ? false:true)}) %>
34 | style='display:none'<% end %>><%= f.select(:warehouse_from_id, @warehouses, {}, {:disabled => (params[:from_options] == 'warehouse_from_id' ? false:true)}) %>
35 | style='display:none'<% end %>><%= f.select(:inventory_providor_id, @providors, {}, {:disabled => (params[:from_options] == 'inventory_providor_id' ? false:true)}) %>
36 |
<%= f.select(:inventory_part_id, @parts, {}, {:onchange => "update_default_value($('#inventory_in_movement_inventory_part_id').val());"}) %>
37 |
<%= f.text_field :serial_number, :size => 8 %>
38 |
<%= f.text_field :quantity, :size => 4, :required => true %>
39 |
<%= f.select(:document_type, @doc_types) %>
40 |
<%= f.text_field :document, :size => 30 %>
41 |
<%= f.text_field :value, :size => 10 %>
42 |
<%= f.select(:warehouse_to_id, @warehouses, {},{:id => 'in_movement_warehouse_to'}) %>
43 | <% if params[:edit_in] %>
44 | <% else %><% end %>
45 |
47 | <%= submit_tag l(:button_submit) %> 48 | <% if params[:edit_in] %>' onclick='location.href="movements"' /><% end %> 49 |
50 | <% end %> -------------------------------------------------------------------------------- /db/migrate/007_keys_and_modifications.rb: -------------------------------------------------------------------------------- 1 | class KeysAndModifications < ActiveRecord::Migration[5.1] 2 | def self.up 3 | execute <<-SQL 4 | ALTER TABLE `inventory_parts` ADD 5 | UNIQUE INDEX `uk_inventory_part_part_number`(`part_number`); 6 | SQL 7 | 8 | execute <<-SQL 9 | ALTER TABLE `inventory_categories` ADD 10 | UNIQUE INDEX `uk_inventory_category_name`(`name`); 11 | SQL 12 | 13 | execute <<-SQL 14 | ALTER TABLE `inventory_providors` ADD 15 | UNIQUE INDEX `uk_inventory_providor_identification`(`identification`); 16 | SQL 17 | 18 | add_column :inventory_movements, :user_from_id, :integer 19 | add_column :inventory_movements, :user_to_id, :integer 20 | add_column :inventory_movements, :warehouse_to_id, :integer 21 | add_column :inventory_movements, :warehouse_from_id, :integer 22 | add_column :inventory_movements, :serial_number, :string 23 | 24 | execute <<-SQL 25 | ALTER TABLE `inventory_movements` ADD 26 | CONSTRAINT `fk_inventory_movement_warehouse_to` FOREIGN KEY (`warehouse_to_id`) 27 | REFERENCES `inventory_warehouses`(`id`) 28 | ON DELETE NO ACTION 29 | ON UPDATE NO ACTION; 30 | SQL 31 | 32 | execute <<-SQL 33 | ALTER TABLE `inventory_movements` ADD 34 | CONSTRAINT `fk_inventory_movement_warehouse_from` FOREIGN KEY (`warehouse_from_id`) 35 | REFERENCES `inventory_warehouses`(`id`) 36 | ON DELETE NO ACTION 37 | ON UPDATE NO ACTION; 38 | SQL 39 | 40 | execute <<-SQL 41 | ALTER TABLE `inventory_movements` ADD 42 | CONSTRAINT `fk_inventory_movement_user` FOREIGN KEY (`user_id`) 43 | REFERENCES `users`(`id`) 44 | ON DELETE NO ACTION 45 | ON UPDATE NO ACTION; 46 | SQL 47 | 48 | execute <<-SQL 49 | ALTER TABLE `inventory_movements` ADD 50 | CONSTRAINT `fk_inventory_movement_user_from` FOREIGN KEY (`user_from_id`) 51 | REFERENCES `users`(`id`) 52 | ON DELETE NO ACTION 53 | ON UPDATE NO ACTION; 54 | SQL 55 | 56 | execute <<-SQL 57 | ALTER TABLE `inventory_movements` ADD 58 | CONSTRAINT `fk_inventory_movement_user_to` FOREIGN KEY (`user_to_id`) 59 | REFERENCES `users`(`id`) 60 | ON DELETE NO ACTION 61 | ON UPDATE NO ACTION; 62 | SQL 63 | 64 | add_column :inventory_parts, :where, :string 65 | 66 | end 67 | 68 | def self.down 69 | execute "ALTER TABLE `inventory_parts` DROP INDEX `uk_inventory_part_part_number`" 70 | execute "ALTER TABLE `inventory_categories` DROP INDEX `uk_inventory_category_name`" 71 | execute "ALTER TABLE `inventory_providors` DROP INDEX `uk_inventory_providor_identification`" 72 | 73 | execute "ALTER TABLE `inventory_movements` DROP INDEX `fk_inventory_movements_user`" 74 | execute "ALTER TABLE `inventory_movements` DROP INDEX `fk_inventory_movements_user_from`" 75 | execute "ALTER TABLE `inventory_movements` DROP INDEX `fk_inventory_movements_user_to`" 76 | execute "ALTER TABLE `inventory_movements` DROP INDEX `fk_inventory_movement_warehouse_from`" 77 | execute "ALTER TABLE `inventory_movements` DROP INDEX `fk_inventory_movement_warehouse_to`" 78 | 79 | remove_column :inventory_movements, :user_from_id 80 | remove_column :inventory_movements, :user_to_id 81 | remove_column :inventory_movements, :warehouse_to_id 82 | remove_column :inventory_movements, :warehouse_from_id 83 | remove_column :inventory_movements, :serial_number 84 | remove_column :inventory_parts, :where 85 | end 86 | end 87 | -------------------------------------------------------------------------------- /app/views/inventory/movements.html.erb: -------------------------------------------------------------------------------- 1 | <%= render :partial => 'top_menu' %> 2 ||
5 | <% if @has_permission %>
6 |
7 |
14 | <% end %>
15 |
16 | 8 | <% if params[:edit_in] %><%= l('Edit') %><% else %><%= l('Create') %><% end%> <%= l('input_movements') %> 9 |10 |style='display:none;'<% end %>>
11 | <%= render :partial => 'movement_in_form' %>
12 |
13 | <%= l('in_movement_list') %>17 | 26 |
|
53 | <% if @has_permission %>
54 |
55 |
62 | <% end %>
63 |
64 | 56 | <% if params[:edit_out] %><%= l('Edit') %><% else %><%= l('Create') %><% end%> <%= l('output_movements') %> 57 |58 |style='display:none;'<% end %>>
59 | <%= render :partial => 'movement_out_form' %>
60 |
61 | <%= l('out_movement_list') %>65 |
|
| <%= l('field_short_part_number') %> | <%= l('field_category') %> | <%= l('field_description') %> | 11 |<%= l('field_value') %> | <%= l('inputs') %> | <%= l('outputs') %> | <%= l('stock') %> | 12 |<%= l('last_movement') %> | <%= l('total') %> |
|---|---|---|---|---|---|---|---|---|
| <%= s[0] %><% if s[1] and s[1].length > 0 %> (<%= s[1] %>)<% end %> | 18 |<%= s[2] %> | 19 |<%= s[3] %> | 20 |<%= number_to_currency(s[4]) %> | 21 |<%= s[5] %> | 22 |<%= s[6] %> | 23 |<%= s[7] %> | 24 |<%= s[8] %> | 25 |<%= number_to_currency(s[4].to_f*s[7].to_f) %> | 26 |
| <%= l('inventory_value') %> | 32 |<%= number_to_currency(total) %> | 33 ||||||||