vyapari 0.1.4 → 0.1.5dev

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/vyapari/sample_stock_bundle.csv +1 -0
  3. data/app/controllers/vyapari/admin/base_controller.rb +10 -0
  4. data/app/controllers/vyapari/admin/brands_controller.rb +99 -0
  5. data/app/controllers/vyapari/admin/categories_controller.rb +115 -0
  6. data/app/controllers/vyapari/admin/countries_controller.rb +2 -2
  7. data/app/controllers/vyapari/admin/dashboard_controller.rb +3 -1
  8. data/app/controllers/vyapari/admin/exchange_rates_controller.rb +2 -2
  9. data/app/controllers/vyapari/admin/products_controller.rb +79 -0
  10. data/app/controllers/vyapari/admin/regions_controller.rb +1 -1
  11. data/app/controllers/vyapari/admin/resource_controller.rb +1 -0
  12. data/app/controllers/vyapari/admin/stores_controller.rb +67 -0
  13. data/app/controllers/vyapari/admin/suppliers_controller.rb +67 -0
  14. data/app/controllers/vyapari/admin/terminals_controller.rb +150 -0
  15. data/app/controllers/vyapari/application_controller.rb +12 -0
  16. data/app/controllers/vyapari/store_manager/base_controller.rb +28 -0
  17. data/app/controllers/vyapari/store_manager/dashboard_controller.rb +30 -0
  18. data/app/controllers/vyapari/store_manager/resource_controller.rb +17 -0
  19. data/app/controllers/vyapari/store_manager/stock_bundles_controller.rb +206 -0
  20. data/app/controllers/vyapari/store_manager/stock_entries_controller.rb +161 -0
  21. data/app/controllers/vyapari/terminal_staff/base_controller.rb +29 -0
  22. data/app/controllers/vyapari/terminal_staff/dashboard_controller.rb +29 -0
  23. data/app/controllers/vyapari/terminal_staff/invoices_controller.rb +138 -0
  24. data/app/controllers/vyapari/terminal_staff/line_items_controller.rb +123 -0
  25. data/app/controllers/vyapari/terminal_staff/resource_controller.rb +17 -0
  26. data/app/controllers/vyapari/user_dashboard_controller.rb +31 -0
  27. data/app/models/brand.rb +63 -10
  28. data/app/models/category.rb +60 -16
  29. data/app/models/country.rb +27 -5
  30. data/app/models/exchange_rate.rb +31 -6
  31. data/app/models/image/brand_image.rb +3 -0
  32. data/app/models/image/category_image.rb +3 -0
  33. data/app/models/image/product_image.rb +3 -0
  34. data/app/models/invoice.rb +223 -0
  35. data/app/models/line_item.rb +206 -0
  36. data/app/models/product.rb +67 -13
  37. data/app/models/region.rb +26 -3
  38. data/app/models/stock_bundle.rb +249 -0
  39. data/app/models/stock_entry.rb +271 -0
  40. data/app/models/store.rb +216 -0
  41. data/app/models/supplier.rb +85 -0
  42. data/app/models/terminal.rb +158 -0
  43. data/app/models/vyapari/application_record.rb +4 -0
  44. data/app/uploaders/brand_image_uploader.rb +14 -0
  45. data/app/uploaders/category_image_uploader.rb +14 -0
  46. data/app/uploaders/product_image_uploader.rb +14 -0
  47. data/app/uploaders/stock_bundle_uploader.rb +10 -0
  48. data/app/views/layouts/kuppayam/_footer.html.erb +1 -1
  49. data/app/views/layouts/kuppayam/_sidebar.html.erb +45 -44
  50. data/app/views/layouts/vyapari/_store_manager_menu.html.erb +107 -0
  51. data/app/views/layouts/vyapari/_terminal_staff_menu.html.erb +103 -0
  52. data/app/views/layouts/vyapari/store_manager.html.erb +112 -0
  53. data/app/views/layouts/vyapari/terminal_staff.html.erb +116 -0
  54. data/app/views/vyapari/admin/brands/_form.html.erb +23 -0
  55. data/app/views/vyapari/admin/brands/_index.html.erb +89 -0
  56. data/app/views/vyapari/admin/brands/_row.html.erb +63 -0
  57. data/app/views/vyapari/admin/brands/_show.html.erb +104 -0
  58. data/app/views/vyapari/admin/brands/index.html.erb +48 -0
  59. data/app/views/vyapari/admin/categories/_form.html.erb +28 -0
  60. data/app/views/vyapari/admin/categories/_index.html.erb +101 -0
  61. data/app/views/vyapari/admin/categories/_row.html.erb +69 -0
  62. data/app/views/vyapari/admin/categories/_show.html.erb +115 -0
  63. data/app/views/vyapari/admin/{users → categories}/index.html.erb +8 -24
  64. data/app/views/vyapari/admin/countries/_index.html.erb +1 -1
  65. data/app/views/vyapari/admin/countries/index.html.erb +19 -3
  66. data/app/views/vyapari/admin/exchange_rates/_form.html.erb +3 -4
  67. data/app/views/vyapari/admin/exchange_rates/_index.html.erb +7 -7
  68. data/app/views/vyapari/admin/exchange_rates/_row.html.erb +3 -3
  69. data/app/views/vyapari/admin/exchange_rates/_show.html.erb +1 -0
  70. data/app/views/vyapari/admin/exchange_rates/index.html.erb +19 -3
  71. data/app/views/vyapari/admin/products/_form.html.erb +32 -0
  72. data/app/views/vyapari/admin/products/_index.html.erb +58 -0
  73. data/app/views/vyapari/admin/products/_row.html.erb +30 -0
  74. data/app/views/vyapari/admin/products/_show.html.erb +81 -0
  75. data/app/views/vyapari/admin/products/index.html.erb +48 -0
  76. data/app/views/vyapari/admin/regions/_index.html.erb +1 -1
  77. data/app/views/vyapari/admin/regions/index.html.erb +19 -3
  78. data/app/views/vyapari/admin/stores/_form.html.erb +37 -0
  79. data/app/views/vyapari/admin/stores/_index.html.erb +84 -0
  80. data/app/views/vyapari/admin/stores/_row.html.erb +55 -0
  81. data/app/views/vyapari/admin/stores/_show.html.erb +110 -0
  82. data/app/views/vyapari/admin/stores/index.html.erb +48 -0
  83. data/app/views/vyapari/admin/suppliers/_form.html.erb +32 -0
  84. data/app/views/vyapari/admin/suppliers/_index.html.erb +58 -0
  85. data/app/views/vyapari/admin/suppliers/_row.html.erb +30 -0
  86. data/app/views/vyapari/admin/suppliers/_show.html.erb +81 -0
  87. data/app/views/vyapari/admin/suppliers/index.html.erb +48 -0
  88. data/app/views/vyapari/admin/terminals/_form.html.erb +24 -0
  89. data/app/views/vyapari/admin/terminals/_index.html.erb +75 -0
  90. data/app/views/vyapari/admin/terminals/_row.html.erb +49 -0
  91. data/app/views/vyapari/admin/terminals/_show.html.erb +74 -0
  92. data/app/views/vyapari/store_manager/dashboard/index.html.erb +93 -0
  93. data/app/views/vyapari/store_manager/stock_bundles/_form.html.erb +99 -0
  94. data/app/views/vyapari/store_manager/stock_bundles/_index.html.erb +74 -0
  95. data/app/views/vyapari/store_manager/stock_bundles/_row.html.erb +44 -0
  96. data/app/views/vyapari/store_manager/stock_bundles/_show.html.erb +110 -0
  97. data/app/views/vyapari/store_manager/stock_bundles/create.html.erb +57 -0
  98. data/app/views/vyapari/store_manager/stock_bundles/index.html.erb +36 -0
  99. data/app/views/vyapari/store_manager/stock_bundles/update.html.erb +57 -0
  100. data/app/views/vyapari/store_manager/stock_entries/_form.html.erb +50 -0
  101. data/app/views/vyapari/store_manager/stock_entries/_index.html.erb +80 -0
  102. data/app/views/vyapari/store_manager/stock_entries/_row.html.erb +33 -0
  103. data/app/views/vyapari/store_manager/stock_entries/_show.html.erb +110 -0
  104. data/app/views/vyapari/store_manager/stock_entries/_stock_bundle.html.erb +61 -0
  105. data/app/views/vyapari/store_manager/stock_entries/index.html.erb +45 -0
  106. data/app/views/vyapari/terminal_staff/dashboard/_counts.html.erb +88 -0
  107. data/app/views/vyapari/terminal_staff/dashboard/_invoices.html.erb +37 -0
  108. data/app/views/vyapari/terminal_staff/dashboard/index.html.erb +36 -0
  109. data/app/views/vyapari/terminal_staff/invoices/_draft.html.erb +62 -0
  110. data/app/views/vyapari/terminal_staff/invoices/_form.html.erb +120 -0
  111. data/app/views/vyapari/terminal_staff/invoices/_index.html.erb +64 -0
  112. data/app/views/vyapari/terminal_staff/invoices/_row.html.erb +33 -0
  113. data/app/views/vyapari/terminal_staff/invoices/_show.html.erb +171 -0
  114. data/app/views/vyapari/terminal_staff/invoices/index.html.erb +37 -0
  115. data/app/views/vyapari/terminal_staff/invoices/new.js.erb +13 -0
  116. data/app/views/vyapari/terminal_staff/invoices/show.html.erb +1 -0
  117. data/app/views/vyapari/terminal_staff/line_items/_form.html.erb +40 -0
  118. data/app/views/vyapari/terminal_staff/line_items/_index.html.erb +94 -0
  119. data/app/views/vyapari/terminal_staff/line_items/create.js.erb +34 -0
  120. data/app/views/vyapari/terminal_staff/line_items/destroy.js.erb +25 -0
  121. data/app/views/vyapari/terminal_staff/stores/index.html.erb +24 -0
  122. data/app/views/vyapari/user_dashboard/index.html.erb +51 -0
  123. data/config/routes.rb +62 -5
  124. data/db/import_data/brands.csv +7 -0
  125. data/db/import_data/categories.csv +12 -0
  126. data/db/import_data/countries.csv +1 -0
  127. data/db/import_data/dummy/brands.csv +7 -0
  128. data/db/import_data/dummy/categories.csv +12 -0
  129. data/db/import_data/dummy/countries.csv +1 -0
  130. data/db/import_data/dummy/exchange_rates.csv +5 -0
  131. data/db/import_data/dummy/products-copy.csv +1 -0
  132. data/db/import_data/dummy/products.csv +1 -0
  133. data/db/import_data/dummy/products.xlsx +0 -0
  134. data/db/import_data/dummy/regions.csv +13 -0
  135. data/db/import_data/dummy/stores.csv +10 -0
  136. data/db/import_data/dummy/suppliers.csv +14 -0
  137. data/db/import_data/dummy/terminals.csv +11 -0
  138. data/db/import_data/exchange_rates.csv +5 -0
  139. data/db/import_data/regions.csv +13 -0
  140. data/db/import_data/stores.csv +3 -0
  141. data/db/import_data/suppliers.csv +14 -0
  142. data/db/import_data/terminals.csv +3 -0
  143. data/db/migrate/20170000000200_create_exchange_rates.rb +3 -2
  144. data/db/migrate/20170000000203_create_contacts.rb +22 -0
  145. data/db/migrate/20170000000204_create_bank_accounts.rb +21 -0
  146. data/db/migrate/20170000000205_create_suppliers.rb +18 -0
  147. data/db/migrate/20170000000206_create_stores.rb +21 -0
  148. data/db/migrate/20170000000207_create_terminals.rb +18 -0
  149. data/db/migrate/20170000000210_create_brands.rb +14 -0
  150. data/db/migrate/20170000000211_create_categories.rb +22 -0
  151. data/db/migrate/20170000000212_create_products.rb +29 -0
  152. data/db/migrate/20170000000213_create_invoices.rb +58 -0
  153. data/db/migrate/20170000000215_create_stock_bundles.rb +17 -0
  154. data/db/migrate/20170000000216_create_stock_entries.rb +20 -0
  155. data/db/sample_reports/products.xlsx +0 -0
  156. data/lib/tasks/vyapari/all.rake +73 -0
  157. data/lib/vyapari/version.rb +1 -1
  158. metadata +150 -15
  159. data/app/controllers/vyapari/admin/users_controller.rb +0 -130
  160. data/app/views/vyapari/admin/users/_form.html.erb +0 -39
  161. data/app/views/vyapari/admin/users/_index.html.erb +0 -101
  162. data/app/views/vyapari/admin/users/_row.html.erb +0 -72
  163. data/app/views/vyapari/admin/users/_show.html.erb +0 -199
  164. data/lib/tasks/vyapari_tasks.rake +0 -4
@@ -0,0 +1,10 @@
1
+ name,code,store_type,region,country
2
+ COMICON 2017,STRCOM17,POS Store,DXBSZR,AE
3
+ SHARJAH MALL ,STRSHJML,POS Store,SHJNAH,AE
4
+ DUBAI MALL ,STRDUML,POS Store,DXBSZR,AE
5
+ MALL OF EMIRATES ,STRMOE,POS Store,DXBALB,AE
6
+ Gitex 2016,STRGTX16,POS Store,DXBSZR,AE
7
+ Gitex 2017,STRGTX17,POS Store,DXBSZR,AE
8
+ Stock Room Al Madina Building,STRMAD,POS Store,DXBBD,AE
9
+ Al Quoz Warehouse,STRALQ,Warehouse ,DXBALQ,AE
10
+ Ajman Warehouse,STRAJM,Warehouse ,AJMPLC,AE
@@ -0,0 +1,14 @@
1
+ name,code,address,city,country
2
+ AL ADIL EXPORTER ,SUPSUPAAE,"No : 11 , Indira Street, ",BOMBEY,IN
3
+ KERALA BEVERAGES CORPORATION ,SUPSUPKBCO,"Aluva , po 6835 , naluketu road , westforte ",KERALA,IN
4
+ BRITISH EAST INDIA COMPANY,SUPBEIC,"Office no 223, cornax building, 2nd elizebeth street",LONDON,EG
5
+ GHANA COFFE CORP,SUPGCC,dummy ,GHANA,GH
6
+ MILLER DOLPHIN GROUP,SUPMDG,dummy ,WASHINGTON,US
7
+ AL KABEER FOODS,SUPAKF,dummy ,SHARJAH,AE
8
+ SAHARAN FOOD INDUSTRIES ,SUPSFI,dummy ,SHARJAH,AE
9
+ ,,,,
10
+ ,,,,
11
+ ,,,,
12
+ ,,,,
13
+ ,,,,
14
+ ,, ,,
@@ -0,0 +1,11 @@
1
+ name,code,store
2
+ COMICON Terminal 1,TERMCOM1,STRCOM17
3
+ COMICON Terminal 2,TERMCOM2,STRCOM17
4
+ Sharjah Mall Terminal,TERMSHJ1,STRSHJML
5
+ Dubai Mall Terminal,TERMDUM,STRDUML
6
+ Mall of Emirates Terminal,TERMMOE,STRMOE
7
+ Gitex 2016 Terminal 1,TERMGTX161,STRGTX16
8
+ Gitex 2016 Terminal 2,TERMGTX162,STRGTX16
9
+ Gitex 2017 Terminal 1,TERMGTX171,STRGTX17
10
+ Gitex 2017 Terminal 2,TERMGTX172,STRGTX17
11
+ Gitex 2017 Terminal 3,TERMGTX173,STRGTX17
@@ -0,0 +1,5 @@
1
+ base_currency,counter_currency,value,effective_date
2
+ INR,AED,18.01,11/3/17
3
+ USD,AED,3.65,1/1/15
4
+ SAR,AED,1.02,11/1/16
5
+ EUR,AED,5.6,11/1/17
@@ -0,0 +1,13 @@
1
+ name,code,country
2
+ BUR DUBAI,DXBBD,AE
3
+ DEIRA,DXBDR,AE
4
+ SHARHAJ Al Nahda,SHJNAH,AE
5
+ AL AIN ,AUHALN,AE
6
+ FUJAIRAH Colony,FJHCOL,AE
7
+ ABU DHABI Mohammad Street,AUHMHD,AE
8
+ JUMAIRAH LAKE TOWERS ,DXBJLT,AE
9
+ JABIL ALI,DXBJBL,AE
10
+ Ajman Place,AJMPLC,AE
11
+ Al QUOZ,DXBALQ,AE
12
+ Sheikh Zayed Road,DXBSZR,AE
13
+ Al Barsha,DXBALB,AE
@@ -0,0 +1,3 @@
1
+ name,code,store_type,region,country
2
+ COMICON 2017,STRCOM17,POS Store,,
3
+ Next Event 2017,STRNE2017,POS Store,,
@@ -0,0 +1,14 @@
1
+ name,code,address,city,country
2
+ ,,,,
3
+ ,,,,
4
+ ,,,,
5
+ ,,,,
6
+ ,,,,
7
+ ,,,,
8
+ ,,,,
9
+ ,,,,
10
+ ,,,,
11
+ ,,,,
12
+ ,,,,
13
+ ,,,,
14
+ ,, ,,
@@ -0,0 +1,3 @@
1
+ name,code,store
2
+ COMICON Terminal 1,TERMCOM1,STRCOM17
3
+ COMICON Terminal 2,TERMCOM2,STRCOM17
@@ -2,7 +2,8 @@ class CreateExchangeRates < ActiveRecord::Migration
2
2
  def change
3
3
  create_table(:exchange_rates) do |t|
4
4
 
5
- t.string :currency_name, limit: 4
5
+ t.string :base_currency, limit: 4
6
+ t.string :counter_currency, limit: 4
6
7
  t.decimal :value, :precision => 16, :scale => 4
7
8
  t.datetime :effective_date
8
9
 
@@ -10,7 +11,7 @@ class CreateExchangeRates < ActiveRecord::Migration
10
11
  end
11
12
 
12
13
  add_reference :exchange_rates, :country
13
- add_index :exchange_rates, [:currency_name, :country_id]
14
+ add_index :exchange_rates, [:base_currency, :counter_currency]
14
15
 
15
16
  end
16
17
  end
@@ -0,0 +1,22 @@
1
+ class CreateContacts < ActiveRecord::Migration
2
+ def change
3
+ create_table(:contacts) do |t|
4
+
5
+ t.string :name, limit: 256
6
+ t.string :designation, :null => true, :limit=>56
7
+ t.string :email, :null => false
8
+ t.string :phone, :null => true, :limit=>24
9
+ t.string :landline, :null => true, :limit=>24
10
+ t.string :fax, :null => true, :limit=>24
11
+
12
+ t.integer :contactable_id
13
+ t.string :contactable_type
14
+
15
+ t.timestamps
16
+ end
17
+
18
+ add_index :contacts, :name
19
+ add_index(:contacts, [ :contactable_id, :contactable_type ])
20
+ end
21
+ end
22
+
@@ -0,0 +1,21 @@
1
+ class CreateBankAccounts < ActiveRecord::Migration
2
+ def change
3
+ create_table(:bank_accounts) do |t|
4
+
5
+ t.string :account_number, limit: 256
6
+ t.string :iban, limit: 56
7
+ t.string :ifsc_swiftcode, limit: 56
8
+ t.string :bank_name, limit: 256
9
+ t.string :branch_name, limit: 56
10
+ t.string :city, limit: 56
11
+ t.references :country
12
+
13
+ t.integer :bank_accountable_id
14
+ t.string :bank_accountable_type
15
+
16
+ t.timestamps
17
+ end
18
+
19
+ add_index(:bank_accounts, [ :bank_accountable_id, :bank_accountable_type ], :name => 'indx_bank_accountable_id_and_type')
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ class CreateSuppliers < ActiveRecord::Migration
2
+ def change
3
+ create_table(:suppliers) do |t|
4
+
5
+ t.string :name, limit: 256
6
+ t.string :code, limit: 24
7
+ t.string :address, limit: 1024
8
+ t.string :city, limit: 56
9
+ t.references :country, index: true
10
+
11
+ t.timestamps
12
+
13
+ end
14
+
15
+ add_index :suppliers, :name
16
+ add_index :suppliers, :code, :unique => true
17
+ end
18
+ end
@@ -0,0 +1,21 @@
1
+ class CreateStores < ActiveRecord::Migration
2
+ def change
3
+ create_table(:stores) do |t|
4
+
5
+ t.string :name, limit: 256
6
+ t.string :code, limit: 24
7
+ t.string :store_type, :null => false, :default=>"POS", :limit=>24
8
+
9
+ t.string :status, :null => false, :default=>"active", :limit=>16
10
+
11
+ t.references :region, index: true
12
+ t.references :country, index: true
13
+
14
+ t.timestamps
15
+
16
+ end
17
+
18
+ add_index :stores, :name
19
+ add_index :stores, :code, :unique => true
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ class CreateTerminals < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :terminals do |t|
4
+
5
+ t.string :name, limit: 256
6
+ t.string :code, limit: 24
7
+
8
+ t.string :status, :null => false, :default=>"active", :limit=>16
9
+
10
+ t.references :store, index: true
11
+
12
+ t.timestamps null: false
13
+ end
14
+
15
+ add_index :terminals, :name
16
+ add_index :terminals, :code, :unique => true
17
+ end
18
+ end
@@ -0,0 +1,14 @@
1
+ class CreateBrands < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :brands do |t|
4
+
5
+ t.string :name, :null => false, limit: 512
6
+ t.boolean :featured, default: false
7
+ t.string :status, :null => false, :default=>"unpublished", :limit=>16
8
+ t.integer :priority
9
+ t.timestamps null: false
10
+ end
11
+
12
+ add_index :brands, :status
13
+ end
14
+ end
@@ -0,0 +1,22 @@
1
+ class CreateCategories < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :categories do |t|
4
+
5
+ t.string :name, :null => false, limit: 128
6
+ t.string :one_liner, limit: 128
7
+
8
+ t.references :parent, references: :category
9
+ t.references :top_parent, references: :category
10
+
11
+ t.string :status, :null => false, :default=>"unpublished", :limit=>16
12
+ t.boolean :featured, default: false
13
+
14
+ t.integer :priority
15
+
16
+ t.timestamps null: false
17
+ end
18
+
19
+ add_index :categories, :status
20
+
21
+ end
22
+ end
@@ -0,0 +1,29 @@
1
+ class CreateProducts < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :products do |t|
4
+
5
+ t.string :name, :null => false, limit: 128
6
+ t.string :one_liner
7
+ t.text :description
8
+
9
+ t.string :ean_sku
10
+ t.string :reference_number
11
+
12
+ t.references :brand
13
+ t.references :category
14
+ t.references :top_category
15
+
16
+ t.decimal :purchased_price, :precision => 16, :scale => 2
17
+ t.decimal :landed_price, :precision => 16, :scale => 2
18
+ t.decimal :selling_price, :precision => 16, :scale => 2
19
+ t.decimal :retail_price, :precision => 16, :scale => 2
20
+
21
+ t.string :status, :null => false, :default=>"unpublished", :limit=>16
22
+ t.boolean :featured, default: false
23
+
24
+ t.timestamps null: false
25
+ end
26
+
27
+ add_index :products, :status
28
+ end
29
+ end
@@ -0,0 +1,58 @@
1
+ class CreateInvoices < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :invoices do |t|
4
+
5
+ t.string :invoice_number, limit: 256
6
+ t.datetime :invoice_date
7
+
8
+ t.string :customer_name
9
+ t.string :customer_address
10
+
11
+ t.integer :discount
12
+ t.decimal :tax
13
+ t.decimal :total_amount
14
+
15
+ t.text :notes
16
+
17
+ # CASH, CREDIT CARD, CHEQUE or CREDIT
18
+ t.string :payment_method, :null => false, :default=>"cash", :limit=>16
19
+
20
+ # If Cash
21
+ t.decimal :adjustment
22
+ t.decimal :money_taken
23
+
24
+ # If Cheque
25
+ t.string :cheque_number
26
+
27
+ # If Credit Card
28
+ t.string :credit_card_number
29
+
30
+ t.string :status, :null => false, :default=>"draft", :limit=>16
31
+
32
+ t.references :terminal, index: true
33
+ t.references :store, index: true
34
+ t.references :user, index: true
35
+
36
+ t.timestamps null: false
37
+ end
38
+
39
+ add_index :invoices, :invoice_number, :unique => true
40
+
41
+ create_table :line_items do |t|
42
+
43
+ t.references :product, index: true
44
+ t.integer :quantity
45
+ t.decimal :rate
46
+ t.decimal :discount
47
+ t.decimal :tax
48
+ t.decimal :total_amount
49
+
50
+ t.references :invoice, index: true
51
+
52
+ t.string :status, :null => false, :default=>"draft", :limit=>16
53
+
54
+ t.timestamps null: false
55
+ end
56
+
57
+ end
58
+ end
@@ -0,0 +1,17 @@
1
+ class CreateStockBundles < ActiveRecord::Migration
2
+ def change
3
+ create_table(:stock_bundles) do |t|
4
+ t.datetime :uploaded_date
5
+ t.references :store, index: true
6
+ t.references :supplier, index: true
7
+ t.references :uploader, references: :users
8
+ t.string :name
9
+ t.string :file
10
+ t.string :error_summary
11
+ t.string :error_details
12
+ t.string :error_file
13
+ t.string :status, :null => false, :default=>"pending", :limit=>16
14
+ t.timestamps
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+ class CreateStockEntries < ActiveRecord::Migration[5.0]
2
+ def change
3
+ create_table :stock_entries do |t|
4
+
5
+ t.references :store
6
+ t.references :product
7
+ t.references :supplier
8
+ t.references :stock_bundle
9
+ t.references :invoice
10
+
11
+ t.integer :quantity
12
+
13
+ # active, damaged, returned, sold, reserved
14
+ t.string :status, :null => false, :default=>"active", :limit=>16
15
+
16
+ t.timestamps null: false
17
+ end
18
+
19
+ end
20
+ end
Binary file
@@ -0,0 +1,73 @@
1
+ require 'csv'
2
+ require 'open-uri'
3
+ require 'time'
4
+
5
+ namespace 'vyapari' do
6
+ namespace 'import' do
7
+
8
+ desc "Import all data in sequence"
9
+ task 'all' => :environment do
10
+
11
+ import_list = ["countries", "regions", "exchange_rates", "suppliers", "stores", "brands", "categories", "terminals"]
12
+
13
+ import_list.each do |item|
14
+ print "Importing #{item.titleize} \t".yellow
15
+ begin
16
+ Rake::Task["vyapari:import:#{item}"].invoke
17
+ rescue ArgumentError => e
18
+ puts "Loading #{item} - Failed - #{e.message}".red
19
+ rescue Exception => e
20
+ puts "Importing #{item.titleize} - Failed - #{e.message}".red
21
+ puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
22
+ end
23
+ end
24
+ puts " "
25
+ end
26
+
27
+ ["Country", "Region", "ExchangeRate", "Supplier", "Store", "Brand", "Category", "Terminal"].each do |cls_name|
28
+ name = cls_name.underscore.pluralize
29
+ desc "Import #{cls_name.pluralize}"
30
+ task name => :environment do
31
+ verbose = true
32
+ verbose = false if ["false", "f","0","no","n"].include?(ENV["verbose"].to_s.downcase.strip)
33
+ path = ENV['path']
34
+ cls_name.constantize.import_data(Vyapari::Engine, path, false, verbose)
35
+ end
36
+ end
37
+
38
+ namespace 'dummy' do
39
+
40
+ desc "Import all dummy data in sequence"
41
+ task 'all' => :environment do
42
+
43
+ import_list = ["dummy:countries", "dummy:regions", "dummy:exchange_rates", "dummy:suppliers", "dummy:stores", "dummy:brands", "dummy:categories", "dummy:terminals"]
44
+
45
+ import_list.each do |item|
46
+ print "Loading #{item.split(':').last.titleize} \t".yellow
47
+ begin
48
+ Rake::Task["vyapari:import:#{item}"].invoke
49
+ rescue ArgumentError => e
50
+ puts "Loading #{item} - Failed - #{e.message}".red
51
+ rescue Exception => e
52
+ puts "Loading #{item} - Failed - #{e.message}".red
53
+ puts "Backtrace:\n\t#{e.backtrace.join("\n\t")}"
54
+ end
55
+ end
56
+ puts " "
57
+ end
58
+
59
+ ["Country", "Region", "ExchangeRate", "Supplier", "Store", "Brand", "Category", "Terminal"].each do |cls_name|
60
+ name = cls_name.underscore.pluralize
61
+ desc "Load Dummy #{cls_name.pluralize}"
62
+ task name => :environment do
63
+ verbose = true
64
+ verbose = false if ["false", "f","0","no","n"].include?(ENV["verbose"].to_s.downcase.strip)
65
+ cls_name.constantize.import_data(Vyapari::Engine, nil, true, verbose)
66
+ end
67
+ end
68
+
69
+ end
70
+
71
+ end
72
+ end
73
+
@@ -1,3 +1,3 @@
1
1
  module Vyapari
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5dev'
3
3
  end