delete shop scope in model
This commit is contained in:
@@ -135,7 +135,7 @@ class Booking < ApplicationRecord
|
||||
joins(" LEFT JOIN dining_facilities df ON df.id=bookings.dining_facility_id")
|
||||
.where("booking_id LIKE ? OR checkin_by LIKE ? OR booking_status LIKE? OR checkout_by LIKE? OR sale_id ='#{filter}' OR df.name LIKE ?","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%")
|
||||
end
|
||||
.shop.order("sale_id DESC")
|
||||
.order("sale_id DESC")
|
||||
end
|
||||
|
||||
def self.get_sync_data(sale_id)
|
||||
|
||||
@@ -20,7 +20,6 @@ class DiningFacility < ApplicationRecord
|
||||
ROOM_TYPE = "Room"
|
||||
|
||||
default_scope { order('order_by asc') }
|
||||
scope :shop, -> { where("shop_code=?",Shop.current_shop.shop_code) }
|
||||
|
||||
scope :active, -> {where(is_active: true)}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ class Menu < ApplicationRecord
|
||||
#Default Scope to pull the active version only
|
||||
default_scope { order("created_at asc") }
|
||||
scope :active, -> {where("is_active = true")}
|
||||
scope :shop, -> { where("menus.shop_code=?",Shop.current_shop.shop_code) }
|
||||
|
||||
def self.current_menu
|
||||
today = DateTime.now
|
||||
@@ -47,7 +46,7 @@ class Menu < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def self.import(file, created_by,shop)
|
||||
def self.import(file, created_by)
|
||||
status = ""
|
||||
spreadsheet = open_spreadsheet(file)
|
||||
if spreadsheet.sheets.count > 1
|
||||
|
||||
@@ -791,7 +791,7 @@ def self.daily_sales_list(from,to)
|
||||
SUM(case when (sale_payments.payment_method='giftvoucher') then sale_payments.payment_amount else 0 end) as giftvoucher_amount,
|
||||
SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount")
|
||||
.along_with_sale_payments_except_void_between(from, to)
|
||||
.where("(sale_status = ? OR sale_status = ?) AND sales.receipt_date between ? AND ? ", 'completed', 'void', from, to).shop
|
||||
.where("(sale_status = ? OR sale_status = ?) AND sales.receipt_date between ? AND ? ", 'completed', 'void', from, to)
|
||||
.group("sale_id").to_sql
|
||||
|
||||
daily_total = connection.select_all("SELECT
|
||||
|
||||
@@ -34,7 +34,7 @@ class SalePayment < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def self.get_kbz_pay_amount(sale_id, current_user,shop)
|
||||
def self.get_kbz_pay_amount(sale_id, current_user)
|
||||
amount = 0
|
||||
kbz_pay_method = PaymentMethodSetting.where(:payment_method => KbzPay::KBZ_PAY).last
|
||||
sale_payment = SalePayment.where('sale_id=? and payment_method=? and payment_status!=?', sale_id, KbzPay::KBZ_PAY, 'dead').last
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
class StockCheck < ApplicationRecord
|
||||
has_many :stock_check_items
|
||||
|
||||
def create(user, reason, item_list,shop)
|
||||
def create(user, reason, item_list)
|
||||
self.reason = reason
|
||||
self.check_by = user.id
|
||||
self.check_start = Time.now
|
||||
self.check_end = Time.now
|
||||
self.shop_code = shop.shop_code
|
||||
save
|
||||
item_list.each do |item|
|
||||
stockItem = StockCheckItem.new
|
||||
|
||||
@@ -67,7 +67,7 @@ class StockCheckItem < ApplicationRecord
|
||||
return query
|
||||
end
|
||||
|
||||
def self.delete_stock_check_item(item_code,shop)
|
||||
def self.delete_stock_check_item(item_code)
|
||||
self.where("item_code=?", item_code).delete_all
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@ class StockJournal < ApplicationRecord
|
||||
return balance.to_i - qty.to_i
|
||||
end
|
||||
|
||||
def self.from_stock_check(item,shop)
|
||||
def self.from_stock_check(item)
|
||||
stock_journal = StockJournal.where("item_code=?", item.item_code).order("id DESC").first
|
||||
if stock_journal.nil?
|
||||
old_blance = 0
|
||||
@@ -57,7 +57,7 @@ class StockJournal < ApplicationRecord
|
||||
end
|
||||
|
||||
|
||||
def self.inventory_balances(from,to, current_shop)
|
||||
def self.inventory_balances(from,to)
|
||||
query = StockJournal.select("mii.item_instance_name as item_instance_name,balance")
|
||||
.joins("join menu_item_instances mii on mii.item_instance_code=stock_journals.item_code")
|
||||
.group("mii.item_instance_name")
|
||||
@@ -76,7 +76,7 @@ class StockJournal < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
def self.delete_stock_journal(item_code,shop)
|
||||
def self.delete_stock_journal(item_code)
|
||||
self.where("item_code=?", item_code).delete_all
|
||||
end
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ class Zone < ApplicationRecord
|
||||
has_many :order_queue_stations
|
||||
has_many :cashier_terminals
|
||||
|
||||
scope :shop, -> { where("shop_code=?",Shop.current_shop.shop_code) }
|
||||
|
||||
# validations
|
||||
validates_presence_of :name, :created_by
|
||||
|
||||
Reference in New Issue
Block a user