vyapari 0.1.5dev3 → 0.1.5dev4

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: 6a5a70a8c9483f8bc1a32832567af9dc9c6a24bf
4
- data.tar.gz: ede330938d7e493e8c9dfc40072af96675fd66e0
3
+ metadata.gz: 86dac64cf698fda0ff1b7b40c71d5a547d584f3e
4
+ data.tar.gz: 2b5c2e4e0f94e4f5f22dedbbf074bd05086bdb23
5
5
  SHA512:
6
- metadata.gz: 9dadf9707c521f3a303dce5839a6c9ed2bf14c558afca86ce52b6c4421056e4d66be51febd0cc450c9eac44531a1f5aa7007468a01beeeac9b1aa72f0aac7a68
7
- data.tar.gz: af3c354a8e087062c9aa631449688cbecb20cef4eebb558e69b25fdbc8f2315bfad92557f9e878d297438ffd5a83eeb7571dc70ae61964a565f210654d00e0c0
6
+ metadata.gz: 0af9fb6fee9286773cf6325c20bfc6c6fbb2794047d6b1d625b2426e95b5a330f0db001ad797387a90e1071e53414eed8c1c1136d810a00abccd1c6b2d5b2c85
7
+ data.tar.gz: f9fafbdcf3e5dc91daf9108e6bd9bc1d555da479ca9a8f377546e49bed223ead0313c70c8ce3d6908ceb4a44f2ccf576fa4a2056ec76d61574fa96cb51567965
@@ -10,8 +10,7 @@ module Vyapari
10
10
  end
11
11
 
12
12
  def default_redirect_url_after_sign_in
13
- asd
14
- vyapari.user_dashboard_url
13
+ vyapari.user_dashboard_url
15
14
  # if @current_user.has_role?("Admin")
16
15
  # vyapari.admin_dashboard_url
17
16
  # elsif @current_user.has_role?("Admin")
@@ -21,6 +21,8 @@ module Vyapari
21
21
  @filter_param_mapping[:stock_bundle] = :sb
22
22
  @filter_param_mapping[:store] = :st
23
23
  @filter_param_mapping[:supplier] = :sp
24
+ @filter_param_mapping[:brand] = :br
25
+ @filter_param_mapping[:category] = :ct
24
26
  end
25
27
 
26
28
  end
@@ -0,0 +1,132 @@
1
+ module Vyapari
2
+ module StoreManager
3
+ module Reports
4
+ class StockController < Vyapari::StoreManager::BaseController
5
+
6
+
7
+ # select MAX(p.id) as id, MAX(p.name) as name,
8
+ # MAX(p.ean_sku) as ean_sku,
9
+ # MAX(p.purchased_price) as purchased_price,
10
+ # MAX(p.landed_price) as landed_price,
11
+ # MAX(p.selling_price) as selling_price,
12
+ # MAX(p.retail_price) as retail_price,
13
+ # SUM(se.quantity) as se_quantity,
14
+ # MAX(se.status) as se_status
15
+ # from products p left join stock_entries se
16
+ # on se.product_id = p.id group by p.id;
17
+ def index
18
+ @relation = Product.select("MAX(products.id) as id,
19
+ MAX(products.name) as name,
20
+ MAX(products.ean_sku) as ean_sku,
21
+ MAX(products.purchased_price) as purchased_price,
22
+ MAX(products.landed_price) as landed_price,
23
+ MAX(products.selling_price) as selling_price,
24
+ MAX(products.retail_price) as retail_price,
25
+ MAX(se.status) as se_status,
26
+ SUM(se.quantity) as se_quantity").
27
+ joins("LEFT JOIN stock_entries se ON se.product_id = products.id")
28
+
29
+ parse_filters
30
+ apply_filters
31
+
32
+ @results = @relation.group("products.id")
33
+ @total = @relation.except(:select).
34
+ select("SUM(products.id) as id,
35
+ SUM(products.purchased_price) as purchased_price,
36
+ SUM(products.landed_price) as landed_price,
37
+ SUM(products.selling_price) as selling_price,
38
+ SUM(products.retail_price) as retail_price")
39
+
40
+ render_report
41
+ end
42
+
43
+ private
44
+
45
+ def apply_filters
46
+ @relation = @relation.search(@query) if @query
47
+ # @relation = @relation.where("se.se_status = ?", @status) if @status
48
+
49
+ @order_by = "products.name ASC, products.ean_sku ASC" unless @order_by
50
+ @relation = @relation.order(@order_by)
51
+ end
52
+
53
+ def configure_filter_settings
54
+ @filter_settings = {
55
+ string_filters: [
56
+ { filter_name: :query },
57
+ { filter_name: :status, options: {default: :pending} }
58
+ ],
59
+
60
+ reference_filters: [
61
+ { filter_name: :brand, filter_class: Brand },
62
+ { filter_name: :category, filter_class: Category },
63
+ ],
64
+
65
+ variable_filters: [
66
+ { variable_name: :store, filter_name: :store },
67
+ { variable_name: :terminal, filter_name: :terminal },
68
+ ]
69
+ }
70
+ end
71
+
72
+ def configure_filter_ui_settings
73
+ @filter_ui_settings = {}
74
+ end
75
+
76
+ def filter_config_ui
77
+ return @filter_config_ui if @filter_config_ui
78
+ @filter_config_ui = {
79
+ brand: {
80
+ object_filter: true,
81
+ display_name: 'Select Brand',
82
+ current_value: @brand,
83
+ values: Brand.order(:name).all,
84
+ current_filters: @filters,
85
+ url_method_name: 'root_url',
86
+ filters_to_remove: [:terminal, :store],
87
+ filters_to_add: {},
88
+ show_null_filter_on_top: true
89
+ },
90
+ category: {
91
+ object_filter: true,
92
+ display_name: 'Select Brand Category',
93
+ current_value: @category,
94
+ values: Category.order(:name).all,
95
+ current_filters: @filters,
96
+ url_method_name: 'root_url',
97
+ filters_to_remove: [:terminal, :store],
98
+ filters_to_add: {},
99
+ show_null_filter_on_top: true
100
+ }
101
+ }
102
+ end
103
+
104
+ def breadcrumbs_configuration
105
+ {
106
+ heading: "Stock Report",
107
+ description: "In Stock Report",
108
+ links: [{name: "Home", link: user_dashboard_path, icon: 'fa-dashboard'},
109
+ {name: "Reports", link: user_dashboard_path, icon: 'fa-calendar', active: true}]
110
+ }
111
+ end
112
+
113
+ def set_navs
114
+ set_nav("reports/stock")
115
+ end
116
+
117
+ def render_report
118
+ respond_to do |format|
119
+ format.html {}
120
+ format.csv { send_data generate_csv(@results), filename: "#{params[:action]}_#{Date.today}.csv" }
121
+ format.pdf do
122
+ render :pdf => "#{@heading} (As on #{Date.today})"
123
+ #:disposition => 'attachment'
124
+ #:show_as_html => true
125
+ end
126
+ end
127
+ end
128
+
129
+ end
130
+ end
131
+ end
132
+ end
@@ -80,7 +80,7 @@ module Vyapari
80
80
  private
81
81
 
82
82
  def get_collections
83
- @relation = @store.stock_entries.where("")
83
+ @relation = @store.stock_entries.includes(:product, :supplier).where("")
84
84
 
85
85
  parse_filters
86
86
  apply_filters
@@ -130,7 +130,7 @@ module Vyapari
130
130
  collection_name: :stock_entries,
131
131
  item_name: :stock_entry,
132
132
  class: StockEntry,
133
- page_title: "#{@store.name} - Stock Entries",
133
+ page_title: "#{@store.name} - Stock",
134
134
  js_view_path: "/kuppayam/workflows/parrot",
135
135
  view_path: "/vyapari/store_manager/stock_entries"
136
136
  }
@@ -138,7 +138,7 @@ module Vyapari
138
138
 
139
139
  def breadcrumbs_configuration
140
140
  {
141
- heading: "#{@store.name} - Stock Entries",
141
+ heading: "#{@store.name} - Stock",
142
142
  description: "Listing all the stock at #{@store.name}",
143
143
  links: [
144
144
  {name: "Home", link: user_dashboard_path, icon: 'fa-dashboard'},
@@ -33,9 +33,19 @@ module Vyapari
33
33
  @invoice.assign_attributes(permitted_params)
34
34
 
35
35
  if @invoice.valid?
36
+
37
+ # Save Invoice
36
38
  @invoice.save
39
+
40
+ # Generating a real invoice number
37
41
  @invoice.generate_real_invoice_number!
42
+
43
+ # Activatingthe Invoice
38
44
  @invoice.activate!
45
+
46
+ # Updating the stock register
47
+ @invoice.update_stock_register!
48
+
39
49
  set_notification(true, @invoice.invoice_number, "Invoice '#{@invoice.invoice_number}' SAVED")
40
50
  else
41
51
  error_message = @invoice.invoice_number || I18n.t('status.error')
@@ -43,6 +43,9 @@ module Vyapari
43
43
  # recalculate the gross total amount
44
44
  @invoice.reload.save
45
45
 
46
+ # Updating the stock register
47
+ @invoice.update_stock_register!
48
+
46
49
  set_notification(true, @line_item.product.ean_sku, "Line Item '#{@line_item.product.name}' ADDED")
47
50
  else
48
51
  if product
@@ -70,6 +73,8 @@ module Vyapari
70
73
  # recalculate the gross total amount
71
74
  @invoice.reload.save
72
75
 
76
+ @invoice.update_stock_register!
77
+
73
78
  get_collections
74
79
  set_flash_message(I18n.t('success.deleted'), :success)
75
80
  set_notification(false, I18n.t('status.success'), I18n.t('success.deleted', item: default_item_name.titleize))
@@ -55,6 +55,7 @@ class Invoice < Vyapari::ApplicationRecord
55
55
  scope :cheque_invoices, -> { where(payment_method: CHEQUE) }
56
56
 
57
57
  scope :this_month, lambda { where("created_at >= ? AND created_at <= ?", Time.zone.now.beginning_of_month, Time.zone.now.end_of_month) }
58
+ scope :today, lambda { where('DATE(created_at) = ?', Date.today)}
58
59
 
59
60
  # ------------------
60
61
  # Instance Methods
@@ -130,6 +131,7 @@ class Invoice < Vyapari::ApplicationRecord
130
131
  # => "active"
131
132
  def activate!
132
133
  self.update_attributes(status: ACTIVE)
134
+ #self.line_items.update_attributes(status: LineItem::SOLD)
133
135
  end
134
136
 
135
137
  # * Return true if the invoice is cancelled, else false.
@@ -146,7 +148,8 @@ class Invoice < Vyapari::ApplicationRecord
146
148
  # >>> invoice.remove!
147
149
  # => "cancelled"
148
150
  def cancel!
149
- self.update_attributes(status: CANCELLED, featured: false)
151
+ self.update_attributes(status: CANCELLED)
152
+ #self.line_items.update_attributes(status: LineItem::CANCELLED)
150
153
  end
151
154
 
152
155
  # * Return true if the invoice is cash, else false.
@@ -210,6 +213,20 @@ class Invoice < Vyapari::ApplicationRecord
210
213
  #return true
211
214
  end
212
215
 
216
+ def update_stock_register!
217
+ return unless self.active?
218
+ self.stock_entries.destroy_all
219
+ self.line_items.each do |li|
220
+ stock_entry = StockEntry.new
221
+ stock_entry.store = self.store
222
+ stock_entry.product = li.product
223
+ stock_entry.invoice_id = self.id
224
+ stock_entry.quantity = li.quantity
225
+ stock_entry.status = LineItem::SOLD
226
+ stock_entry.save
227
+ end
228
+ end
229
+
213
230
  def generate_real_invoice_number!
214
231
  self.invoice_number = "INV-#{self.terminal.code}-#{self.id}"
215
232
  self.save
@@ -5,9 +5,10 @@ class LineItem < Vyapari::ApplicationRecord
5
5
  SOLD = "sold"
6
6
  DAMAGED = "damaged"
7
7
  RETURNED = "returned"
8
+ CANCELLED = "cancelled"
8
9
 
9
- STATUS_HASH = {"Draft" => DRAFT, "Sold" => SOLD, "Damaged" => DAMAGED, "Returned" => RETURNED}
10
- STATUS_HASH_REVERSE = {DRAFT => "Draft", SOLD => "Sold", DAMAGED => "Damaged", RETURNED => "Returned"}
10
+ STATUS_HASH = {"Draft" => DRAFT, "Sold" => SOLD, "Damaged" => DAMAGED, "Returned" => RETURNED, "Cancelled" => CANCELLED}
11
+ STATUS_HASH_REVERSE = {DRAFT => "Draft", SOLD => "Sold", DAMAGED => "Damaged", RETURNED => "Returned", CANCELLED => "Cancelled"}
11
12
 
12
13
  # Call backs
13
14
  before_save :calculate_total_amount
@@ -50,6 +50,9 @@ class StockEntry < Vyapari::ApplicationRecord
50
50
  scope :reserved, -> { where(status: RESERVED) }
51
51
  scope :in_stock, -> { where(status: [ACTIVE, RECEIVED, RETURNED]) }
52
52
 
53
+ scope :this_month, lambda { where("created_at >= ? AND created_at <= ?", Time.zone.now.beginning_of_month, Time.zone.now.end_of_month) }
54
+ scope :today, lambda { where('DATE(created_at) = ?', Date.today)}
55
+
53
56
  def self.save_row_data(row)
54
57
 
55
58
  row.headers.each{ |cell| row[cell] = row[cell].to_s.strip }
data/app/models/store.rb CHANGED
@@ -131,6 +131,60 @@ class Store < Vyapari::ApplicationRecord
131
131
  true
132
132
  end
133
133
 
134
+ def sold_items_count_for_today
135
+ self.stock_entries.today.sold.sum(:quantity)
136
+ end
137
+
138
+ def sold_items_count_for_this_month
139
+ self.stock_entries.this_month.sold.sum(:quantity)
140
+ end
141
+
142
+ def damaged_items_count_for_today
143
+ self.stock_entries.today.damaged.sum(:quantity)
144
+ end
145
+
146
+ def damaged_items_count_for_this_month
147
+ self.stock_entries.this_month.damaged.sum(:quantity)
148
+ end
149
+
150
+ def returned_items_count_for_today
151
+ self.stock_entries.today.returned.sum(:quantity)
152
+ end
153
+
154
+ def returned_items_count_for_this_month
155
+ self.stock_entries.this_month.returned.sum(:quantity)
156
+ end
157
+
158
+ def reserved_items_count_for_today
159
+ self.stock_entries.today.reserved.sum(:quantity)
160
+ end
161
+
162
+ def reserved_items_count_for_this_month
163
+ self.stock_entries.this_month.reserved.sum(:quantity)
164
+ end
165
+
166
+ def in_stock_items_count_as_of_now
167
+ self.stock_entries.active.sum(:quantity) - self.stock_entries.sold.sum(:quantity)
168
+ end
169
+
170
+ def total_no_of_products_in_stock
171
+ self.stock_entries.active.count
172
+ # - self.stock_entries.sold.count
173
+ # self.stock_entries.active.count - self.stock_entries.sold.count
174
+ #begin
175
+ # result = Product.select("COUNT(products.id) as id, MAX(se.store_id) as store_id").
176
+ # joins("LEFT JOIN stock_entries se ON se.product_id = products.id").
177
+ # where("se.store_id = ?", self.id).
178
+ # group("products.id")
179
+ # return result.size.to_i
180
+ #rescue
181
+ #0
182
+ #end
183
+ end
184
+
185
+
186
+
187
+
134
188
  # * Return true if the brand is active, else false.
135
189
  # == Examples
136
190
  # >>> brand.active?
@@ -1,15 +1,14 @@
1
1
  <%
2
- total_count = @store.stock_entries.count
3
- in_stock_count = @store.stock_entries.in_stock.count
4
- damaged_count = @store.stock_entries.damaged.count
5
- sold_count = @store.stock_entries.sold.count
6
- reserved_count = @store.stock_entries.reserved.count
2
+ #total_no_of_products_in_stock = @store.stock_entries.active.count
3
+ #in_stock_count = @store.stock_entries.in_stock.count
4
+ #damaged_count = @store.stock_entries.damaged.count
5
+ #reserved_count = @store.stock_entries.reserved.count
7
6
  %>
8
7
 
9
8
  <div class="chart-item-bg-2">
10
9
  <div class="chart-item-num" data-count="this" data-from="0" data-to="98" data-suffix="%" data-duration="2">
11
- <i class="fa-list"></i>
12
- <%= total_count %> <span style="font-size:20px">Product Items</span>
10
+ <i class="fa-truck"></i>
11
+ <%= @store.total_no_of_products_in_stock %> <span style="font-size:20px">Products</span>
13
12
  </div>
14
13
  <div class="chart-item-desc">
15
14
  <%= link_to raw("<i class=\"fa-truck mr-10\"></i> View Stock"), store_manager_stock_entries_path(@store), class: "btn btn-success btn-lg btn-block", style: "height:50px" %>
@@ -20,23 +19,23 @@
20
19
  <div class="row">
21
20
  <div class="col-sm-3">
22
21
 
23
- <div class="xe-widget xe-counter xe-counter-success" data-count=".num" data-from="0" data-to="99.9" data-suffix="%" data-duration="2">
22
+ <div class="xe-widget xe-counter xe-counter-info" data-count=".num" data-from="1" data-to="117" data-suffix="k" data-duration="3" data-easing="false">
24
23
  <div class="xe-icon">
25
- <i class="fa-shopping-cart"></i>
24
+ <i class="fa-truck"></i>
26
25
  </div>
27
26
  <div class="xe-label">
28
- <strong class="num"><%= sold_count %></strong>
29
- <span>SOLD</span>
27
+ <strong class="num"><%= @store.in_stock_items_count_as_of_now %></strong>
28
+ <span>TOTAL QUANTITY IN STOCK</span>
30
29
  </div>
31
30
  </div>
32
31
 
33
- <div class="xe-widget xe-counter xe-counter-info" data-count=".num" data-from="1" data-to="117" data-suffix="k" data-duration="3" data-easing="false">
32
+ <div class="xe-widget xe-counter xe-counter-success" data-count=".num" data-from="0" data-to="99.9" data-suffix="%" data-duration="2">
34
33
  <div class="xe-icon">
35
- <i class="fa-truck"></i>
34
+ <i class="fa-shopping-cart"></i>
36
35
  </div>
37
36
  <div class="xe-label">
38
- <strong class="num"><%= in_stock_count %></strong>
39
- <span>IN STOCK</span>
37
+ <strong class="num"><%= @store.sold_items_count_for_today %></strong>
38
+ <span>ITEMS SOLD TODAY</span>
40
39
  </div>
41
40
  </div>
42
41
 
@@ -45,8 +44,8 @@
45
44
  <i class="fa-ban"></i>
46
45
  </div>
47
46
  <div class="xe-label">
48
- <strong class="num"><%= damaged_count %></strong>
49
- <span>DAMAGED</span>
47
+ <strong class="num"><%= @store.damaged_items_count_for_today %></strong>
48
+ <span>ITEMS DAMAGED TODAY</span>
50
49
  </div>
51
50
  </div>
52
51
 
@@ -55,7 +54,7 @@
55
54
  <i class="fa-bookmark"></i>
56
55
  </div>
57
56
  <div class="xe-label">
58
- <strong class="num"><%= reserved_count %></strong>
57
+ <strong class="num"><%= @store.reserved_items_count_for_today %></strong>
59
58
  <span>RESERVED</span>
60
59
  </div>
61
60
  </div>
@@ -0,0 +1,72 @@
1
+ <div class="table-responsive table-scrollable">
2
+ <table class="table table-striped table-condensed table-bordered">
3
+ <thead>
4
+ <tr>
5
+ <th style="text-align: center;width:60px">#</th>
6
+ <th>Product Name</th>
7
+ <th style="width:15%;text-align: center;">EAN/SKU</th>
8
+ <th style="text-align: right;">PP</th>
9
+ <th style="text-align: right;">LP</th>
10
+ <th style="text-align: right;">SP</th>
11
+ <th style="text-align: right;">RP</th>
12
+ <th style="text-align: center;">Quantity</th>
13
+ <th>Status</th>
14
+ <th style="text-align: center;">Actions</th>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+
19
+ <%# filters_to_add = {permalink: @current_company_group.permalink, code: @current_company.code } %>
20
+
21
+ <%# short_filters = generate_short_url_filters(@filters, filters_to_add, [:store, :terminal]) %>
22
+
23
+ <%#= link_to item.name, jobs_path(short_filters.merge(br: item.id)), target: :blank %>
24
+
25
+ <% @results.each_with_index do |item, i| %>
26
+ <tr>
27
+ <th scope="row" style="text-align: center;"><%= i + 1 + (@per_page.to_i * (@current_page.to_i - 1)) %></th>
28
+
29
+ <td>
30
+ <%= link_to item.name, "#", target: :blank %>
31
+ </td>
32
+
33
+ <td>
34
+ <%= item.ean_sku %>
35
+ </td>
36
+
37
+ <td style="text-align: right;"><%= number_to_currency item.purchased_price, unit: "AED " %></td>
38
+
39
+ <td style="text-align: right;"><%= number_to_currency item.landed_price, unit: "AED " %></td>
40
+
41
+ <td style="text-align: right;"><%= number_to_currency item.selling_price, unit: "AED " %></td>
42
+
43
+ <td style="text-align: right;"><%= number_to_currency item.retail_price, unit: "AED " %></td>
44
+
45
+ <td>
46
+ <%#= item.se_quantity %>
47
+ </td>
48
+
49
+ <td>
50
+ <%#= item.se_status %>
51
+ </td>
52
+
53
+ </tr>
54
+ <% end %>
55
+ </tbody>
56
+ <tfoot>
57
+ <% if @total && @total.first && @total.first.purchased_price %>
58
+ <tr>
59
+ <td></td>
60
+ <td></td>
61
+ <td></td>
62
+ <td style="font-weight: bold;text-align: right;"><%= number_to_currency @total.first.purchased_price.to_s, unit: "AED " %></td>
63
+ <td style="font-weight: bold;text-align: right;"><%= number_to_currency @total.first.landed_price.to_s, unit: "AED " %></td>
64
+ <td style="font-weight: bold;text-align: right;"><%= number_to_currency @total.first.selling_price.to_s, unit: "AED " %></td>
65
+ <td style="font-weight: bold;text-align: right;"><%= number_to_currency @total.first.retail_price.to_s, unit: "AED " %></td>
66
+ <td></td>
67
+ <td></td>
68
+ </tr>
69
+ <% end %>
70
+ </tfoot>
71
+ </table>
72
+ </div>
@@ -0,0 +1,32 @@
1
+ <div class="panel panel-default">
2
+ <div class="panel-heading">
3
+ Filters
4
+ </div>
5
+ <div class="panel-body">
6
+
7
+ <div id="div_report_filter_list">
8
+ <%#= render :partial=>"/reports/company_jpr/display_filters" %>
9
+ <hr>
10
+ <%= clear_tag(10) %>
11
+ <%#= render :partial=>"/reports/company_jpr/display_dropdown_filters" %>
12
+ </div>
13
+ <%= clear_tag(10) %>
14
+
15
+ </div>
16
+ </div>
17
+
18
+ <div class="panel panel-default">
19
+ <div class="panel-body">
20
+
21
+ <%= clear_tag(10) %>
22
+
23
+ <div id="div_report_index">
24
+ <%#= render :partial=>"/reports/company_jpr/chart" %>
25
+ <%#= clear_tag(100) %>
26
+ <%= render :partial=>"vyapari/store_manager/reports/stock/index" %>
27
+ </div>
28
+ <%= clear_tag(10) %>
29
+
30
+ </div>
31
+ </div>
32
+
@@ -34,7 +34,7 @@
34
34
 
35
35
  <td class="stock_entry-name"><%= link_to stock_entry.product.name, store_manager_stock_entries_path(@store, stock_entry), remote: true %></td>
36
36
 
37
- <td class="stock_entry-name" style="text-align: center;"><%= link_to stock_entry.product.ean_sku, store_manager_stock_entries_path(@store, stock_entry), remote: true %></td>
37
+ <td class="stock_entry-name" style="text-align: center;"><%= stock_entry.product.ean_sku %></td>
38
38
 
39
39
  <td class="stock_entry-name" style="text-align: right;">
40
40
  <%= number_to_currency stock_entry.product.purchased_price, unit: "" %>
@@ -1,10 +1,10 @@
1
1
  <%
2
- active_invoices = @terminal.invoices.active.count
3
- draft_invoices = @terminal.invoices.draft.count
4
- active_amount = @terminal.invoices.active.sum(:net_total_amount)
5
- draft_amount = @terminal.invoices.draft.sum(:net_total_amount)
6
- cash_invoices = @terminal.invoices.active.where(payment_method: :cash).count
7
- cash_in_hand = @terminal.invoices.active.cash_invoices.sum(:net_total_amount)
2
+ active_invoices = @terminal.invoices.active.today.count
3
+ draft_invoices = @terminal.invoices.draft.today.count
4
+ active_amount = @terminal.invoices.active.today.sum(:net_total_amount)
5
+ draft_amount = @terminal.invoices.draft.today.sum(:net_total_amount)
6
+ cash_invoices = @terminal.invoices.active.today.where(payment_method: :cash).count
7
+ cash_in_hand = @terminal.invoices.active.today.cash_invoices.sum(:net_total_amount)
8
8
  total_sales = 100
9
9
  %>
10
10
 
@@ -55,7 +55,7 @@
55
55
  <div class="xe-lower">
56
56
  <div class="border"></div>
57
57
 
58
- <span>Total Amount Billed</span>
58
+ <span>Total Amount Billed Today</span>
59
59
  <strong><%= number_to_currency active_amount, unit: "AED " %></strong>
60
60
  </div>
61
61
  </div>
@@ -10,7 +10,7 @@
10
10
 
11
11
  <div class="panel-body">
12
12
  <!-- Active Invoices -->
13
- <% active_invoices = @terminal.invoices.active.order("created_at DESC").page(1).per(10) %>
13
+ <% active_invoices = @terminal.invoices.active.today.order("created_at DESC").page(1).per(10) %>
14
14
  <%= render :partial=>"vyapari/terminal_staff/dashboard/invoices", locals: { invoices: active_invoices } -%>
15
15
  </div>
16
16
  </div>
@@ -25,7 +25,7 @@
25
25
 
26
26
  <div class="panel-body">
27
27
  <!-- Draft Invoices -->
28
- <% draft_invoices = @terminal.invoices.draft.order("created_at DESC").page(1).per(10) %>
28
+ <% draft_invoices = @terminal.invoices.draft.today.order("created_at DESC").page(1).per(10) %>
29
29
  <%= render :partial=>"vyapari/terminal_staff/dashboard/invoices", locals: { invoices: draft_invoices } -%>
30
30
  </div>
31
31
 
@@ -52,7 +52,7 @@
52
52
 
53
53
  <ul class="list-unstyled mt-30">
54
54
  <li class="upper fs-20">Invoice No: <strong>#<%= @invoice.invoice_number%></strong></li>
55
- <li class="mt-10">Invoice No: <%= @invoice.invoice_date.strftime("%m/%d/%Y") %></li>
55
+ <li class="mt-10">Invoice Date: <%= @invoice.invoice_date.strftime("%m/%d/%Y") %></li>
56
56
  <!-- <li>Dubai</li> -->
57
57
  </ul>
58
58
 
@@ -98,7 +98,7 @@
98
98
  <!-- Invoice Entries -->
99
99
  <table class="table table-bordered mt-60">
100
100
  <thead>
101
- <tr style="background-color: #4b4b4b; color:red;">
101
+ <tr style="">
102
102
  <th width="10%" class="text-center">No</th>
103
103
  <th width="40%" class="text-center">Item</th>
104
104
  <th width="15%" class="text-center">Unit Price</th>
@@ -142,7 +142,7 @@
142
142
 
143
143
  <% if @invoice.discount %>
144
144
  <span class="mt-10 fs-20">
145
- Discount (<%= number_to_currency @invoice.discount, unit: "%" %>):
145
+ Discount (<%= @invoice.discount %>) %:
146
146
  <strong><%= number_to_currency @invoice.discount_amount, unit: "AED " %></strong>
147
147
  </span>
148
148
  <% end %>
data/config/routes.rb CHANGED
@@ -56,7 +56,8 @@ Vyapari::Engine.routes.draw do
56
56
  namespace :store_manager do
57
57
 
58
58
  scope '/:store_id' do
59
- get 'dashboard', to: "dashboard#index", as: :dashboard
59
+ get '/dashboard', to: "dashboard#index", as: :dashboard
60
+ get '/reports/stock', to: "reports/stock#index", as: :stock_report
60
61
  resources :terminals
61
62
  resources :stock_entries
62
63
  resources :stock_bundles do
@@ -1,3 +1,3 @@
1
1
  module Vyapari
2
- VERSION = '0.1.5dev3'
2
+ VERSION = '0.1.5dev4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vyapari
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5dev3
4
+ version: 0.1.5dev4
5
5
  platform: ruby
6
6
  authors:
7
7
  - kpvarma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-05 00:00:00.000000000 Z
11
+ date: 2017-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -350,6 +350,7 @@ files:
350
350
  - app/controllers/vyapari/application_controller.rb
351
351
  - app/controllers/vyapari/store_manager/base_controller.rb
352
352
  - app/controllers/vyapari/store_manager/dashboard_controller.rb
353
+ - app/controllers/vyapari/store_manager/reports/stock_controller.rb
353
354
  - app/controllers/vyapari/store_manager/resource_controller.rb
354
355
  - app/controllers/vyapari/store_manager/stock_bundles_controller.rb
355
356
  - app/controllers/vyapari/store_manager/stock_entries_controller.rb
@@ -437,6 +438,8 @@ files:
437
438
  - app/views/vyapari/admin/terminals/_row.html.erb
438
439
  - app/views/vyapari/admin/terminals/_show.html.erb
439
440
  - app/views/vyapari/store_manager/dashboard/index.html.erb
441
+ - app/views/vyapari/store_manager/reports/stock/_index.html.erb
442
+ - app/views/vyapari/store_manager/reports/stock/index.html.erb
440
443
  - app/views/vyapari/store_manager/stock_bundles/_form.html.erb
441
444
  - app/views/vyapari/store_manager/stock_bundles/_index.html.erb
442
445
  - app/views/vyapari/store_manager/stock_bundles/_row.html.erb