current shop changes

This commit is contained in:
Nweni
2019-11-28 18:33:56 +06:30
parent d41d957688
commit 3a85f1e319
9 changed files with 59 additions and 46 deletions

View File

@@ -18,8 +18,8 @@ class HomeController < ApplicationController
def index
# @employees = Employee.all_emp_except_waiter.order("name asc")
@employees = Employee.all.where("shop_code='#{current_shop.shop_code}' and is_active = true").order("name asc")
@roles = Employee.where("shop_code='#{current_shop.shop_code}'").distinct.pluck(:role)
@employees = Employee.all.where("shop_code='#{@current_shop.shop_code}' and is_active = true").order("name asc")
@roles = Employee.where("shop_code='#{@current_shop.shop_code}'").distinct.pluck(:role)
# byebug
# @roles = Lookup.collection_of("employee_roles")
@@ -106,10 +106,10 @@ class HomeController < ApplicationController
end
@top_products = Sale.top_bottom_products(current_user,@from,@to,"top")
@bottom_products = Sale.top_bottom_products(current_user,@from,@to,"bottom")
@hourly_sales = Sale.hourly_sales(current_user,@from,@to)
employee_sales = Sale.employee_sales(current_user,@from,@to)
@top_products = Sale.top_bottom_products(current_user,@from,@to,"top",current_shop)
@bottom_products = Sale.top_bottom_products(current_user,@from,@to,"bottom",current_shop)
@hourly_sales = Sale.hourly_sales(current_user,@from,@to,current_shop)
employee_sales = Sale.employee_sales(current_user,@from,@to,current_shop)
@employee_sales = []
if !employee_sales.nil?
@@ -123,11 +123,11 @@ class HomeController < ApplicationController
end
end
@inventories = StockJournal.inventory_balances(@from,@to).sum(:balance)
@inventories = StockJournal.inventory_balances(@from,@to, current_shop).sum(:balance)
@total_trans = Sale.total_trans(current_user,@from,@to)
@total_card = Sale.total_card_sale(current_user,@from,@to)
@total_credit = Sale.credit_payment(current_user,@from,@to)
@total_credit = Sale.credit_payment(current_user,@from,@to, current_shop)
@sale_data = Array.new
@total_payment_methods = Sale.total_payment_methods(current_user,@from,@to)
@@ -143,7 +143,7 @@ class HomeController < ApplicationController
@total_customer, @total_dinein, @total_takeaway, @total_membership = Sale.total_customer(current_user,@from,@to)
# @total_other_customer = Sale.total_other_customer(today,current_user)
@total_order = Sale.total_order(current_user,@from,@to)
@total_order = Sale.total_order(current_user,@from,@to, current_shop)
@total_accounts = Account.select("accounts.id as account_id, accounts.title as title")
@account_data = Array.new
if !@total_accounts.nil?