delete shop scope in model

This commit is contained in:
Zin Moe
2020-01-13 18:41:37 +06:30
parent a3edbb07fd
commit 270c2a821e
20 changed files with 25 additions and 29 deletions

View File

@@ -223,7 +223,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController
@pdf_view = @lookup_pdf.value
end
amount = SalePayment.get_kbz_pay_amount(sale_id, current_user,current_shop)
amount = SalePayment.get_kbz_pay_amount(sale_id, current_user)
@kbz_pay_amount += amount.to_f
#for changable on/off

View File

@@ -124,7 +124,7 @@ class HomeController < ApplicationController
end
end
@inventories = StockJournal.inventory_balances(@from,@to, current_shop).sum(:balance)
@inventories = StockJournal.inventory_balances(@from,@to).sum(:balance)
@total_trans = Sale.total_trans(current_user,@from,@to)
@total_card = Sale.total_card_sale(current_user,@from,@to)

View File

@@ -90,8 +90,8 @@ class Inventory::InventoryDefinitionsController < BaseInventoryController
format.json { head :no_content }
end
StockJournal.delete_stock_journal(inventory.item_code,current_shop)
StockCheckItem.delete_stock_check_item(inventory.item_code,current_shop)
StockJournal.delete_stock_journal(inventory.item_code)
StockCheckItem.delete_stock_check_item(inventory.item_code)
if !inventory.nil?
inventory.destroy
flash[:message] = 'Inventory was successfully destroyed.'

View File

@@ -19,7 +19,7 @@ class Inventory::StockChecksController < BaseInventoryController
item_list = JSON.parse(params[:stock_item])
reason = params[:reason]
check = StockCheck.new
@check = check.create(current_user, reason, item_list,current_shop)
@check = check.create(current_user, reason, item_list)
end
def show
@@ -33,7 +33,7 @@ class Inventory::StockChecksController < BaseInventoryController
check = params[:data]
stockCheck = StockCheck.find_by_id(check)
stockCheck.stock_check_items.each do |item|
StockJournal.from_stock_check(item,current_shop)
StockJournal.from_stock_check(item)
end
end

View File

@@ -11,7 +11,7 @@ class Origami::HomeController < BaseOrigamiController
@customers = Customer.pluck("customer_id, name")
@occupied_table = DiningFacility.where("status='occupied'").shop.count
@occupied_table = DiningFacility.where("status='occupied'").count
@shift = ShiftSale.current_open_shift(current_user)
end

View File

@@ -275,7 +275,7 @@ class Origami::PaymentsController < BaseOrigamiController
@pdf_view = @lookup_pdf.value
end
amount = SalePayment.get_kbz_pay_amount(sale_id, current_user, current_shop)
amount = SalePayment.get_kbz_pay_amount(sale_id, current_user)
@kbz_pay_amount += amount.to_f
#for changable on/off

View File

@@ -157,7 +157,7 @@ class Settings::MenusController < ApplicationController
def import
if params[:file]
status = Menu.import(params[:file], current_user.name,current_shop)
status = Menu.import(params[:file], current_user.name)
redirect_to settings_menus_path, notice: status
end
end

View File

@@ -23,10 +23,10 @@ class Transactions::CreditNotesController < ApplicationController
.joins("JOIN sale_payments sp on sp.sale_id = sales.sale_id")
.where("(CASE WHEN (sales.grand_total + sales.amount_changed)=(select SUM(sale_payments.payment_amount)
FROM sale_payments WHERE sale_payments.sale_id=sales.sale_id AND sale_payments.payment_method!='creditnote')
THEN NULL ELSE payment_method='creditnote' END)").shop
THEN NULL ELSE payment_method='creditnote' END)")
@credit_notes = Kaminari.paginate_array(@credit_notes).page(params[:page]).per(20)
else
sale = Sale.search_credit_sales(customer,filter,from,to,order_source).shop
sale = Sale.search_credit_sales(customer,filter,from,to,order_source)
if !sale.nil?
@credit_notes = sale
@credit_notes = Kaminari.paginate_array(@credit_notes).page(params[:page]).per(20)

View File

@@ -18,13 +18,13 @@ class Transactions::SalesController < ApplicationController
if receipt_no.nil? && from.nil? && to.nil?
if @shift.blank?
@sales = Sale.where("NOT sale_status='new'").shop.order("sale_id desc")
@sales = Sale.where("NOT sale_status='new'").order("sale_id desc")
else
@sales = Sale.where("NOT sale_status='new' and shift_sale_id ='#{@shift.id}'").shop.order("sale_id desc")
@sales = Sale.where("NOT sale_status='new' and shift_sale_id ='#{@shift.id}'").order("sale_id desc")
end
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
else
sale = Sale.search(receipt_no,from,to,@shift).shop
sale = Sale.search(receipt_no,from,to,@shift)
if sale.count > 0
@sales = sale
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)