Read NFC
This commit is contained in:
@@ -25,8 +25,8 @@ class InventoryDefinition < ApplicationRecord
|
||||
|
||||
|
||||
def self.find_product_in_inventory(item)
|
||||
if product = InventoryDefinition.find_by_item_code_and_shop_code(item.item_instance_code,Shop.current_shop.shop_code)
|
||||
if stock_check_item = StockCheckItem.find_by_item_code_and_shop_code(item.item_instance_code,Shop.current_shop.shop_code)
|
||||
if product = InventoryDefinition.find_by_item_code(item.item_instance_code)
|
||||
if stock_check_item = StockCheckItem.find_by_item_code(item.item_instance_code)
|
||||
return true, product
|
||||
end
|
||||
end
|
||||
@@ -34,7 +34,7 @@ class InventoryDefinition < ApplicationRecord
|
||||
|
||||
def self.check_balance(item, inventory_definition) # item => saleItemOBj
|
||||
|
||||
stock = StockJournal.where("shop_code='#{inventory_definition.shop_code}' and item_code=?", item.item_instance_code).order("id DESC").first
|
||||
stock = StockJournal.where("item_code=?", item.item_instance_code).order("id DESC").first
|
||||
unless stock.nil?
|
||||
modify_balance(item, stock, inventory_definition)
|
||||
else
|
||||
@@ -99,7 +99,7 @@ class InventoryDefinition < ApplicationRecord
|
||||
" JOIN menu_items mi ON mi.id = mii.menu_item_id" +
|
||||
" JOIN menu_categories mc ON mc.id = mi.menu_category_id ")
|
||||
.joins(" JOIN accounts acc ON acc.id = mi.account_id")
|
||||
.where("inventory_definitions.shop_code='#{shop.shop_code}' and (inventory_definitions.item_code LIKE ? OR inventory_definitions.min_order_level LIKE ?
|
||||
.where("(inventory_definitions.item_code LIKE ? OR inventory_definitions.min_order_level LIKE ?
|
||||
OR inventory_definitions.max_stock_level LIKE ? OR sj.balance LIKE ? OR mi.name LIKE ?
|
||||
OR mii.item_instance_name LIKE ? OR mc.name LIKE ?)","%#{filter}%","%#{filter}%","%#{filter}%",
|
||||
"%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%")
|
||||
|
||||
Reference in New Issue
Block a user