shop code
This commit is contained in:
@@ -8,19 +8,23 @@ class Inventory::StockChecksController < BaseInventoryController
|
||||
.joins("JOIN menu_item_instances mii ON mii.item_instance_code = inventory_definitions.item_code" +
|
||||
" JOIN menu_items mi ON mi.id = mii.menu_item_id" +
|
||||
" JOIN menu_categories mc ON mc.id = mi.menu_category_id ")
|
||||
.where("inventory_definitions.shop_code='#{@shop.shop_code}'")
|
||||
.group("mi.menu_category_id")
|
||||
.order("mi.menu_category_id desc")
|
||||
unless !@category.nil?
|
||||
@category_id =@category[0].id
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
item_list = JSON.parse(params[:stock_item])
|
||||
reason = params[:reason]
|
||||
check = StockCheck.new
|
||||
@check = check.create(current_user, reason, item_list)
|
||||
@check = check.create(current_user, reason, item_list,@shop)
|
||||
end
|
||||
|
||||
def show
|
||||
@check = StockCheck.find(params[:id])
|
||||
@check = StockCheck.find_by_id_and_shop_code(params[:id],@shop.shop_code)
|
||||
|
||||
@stock_check_items = StockCheckItem.get_items_with_category(params[:id])
|
||||
|
||||
@@ -28,31 +32,31 @@ class Inventory::StockChecksController < BaseInventoryController
|
||||
|
||||
def save_to_journal
|
||||
check = params[:data]
|
||||
stockCheck = StockCheck.find(check)
|
||||
stockCheck = StockCheck.find_by_id_and_shop_code(check,@shop.shop_code)
|
||||
stockCheck.stock_check_items.each do |item|
|
||||
StockJournal.from_stock_check(item)
|
||||
StockJournal.from_stock_check(item,@shop)
|
||||
end
|
||||
end
|
||||
|
||||
def print_stock_check
|
||||
stock_id = params[:stock_check_id] # sale_id
|
||||
stockcheck = StockCheck.find(stock_id)
|
||||
stockcheck = StockCheck.find_by_id_and_shop_code(stock_id,@shop.shop_code)
|
||||
stockcheck_items = stockcheck.stock_check_items
|
||||
member_info = nil
|
||||
unique_code = 'StockCheckPdf'
|
||||
|
||||
shop_details = current_shop
|
||||
checker = Employee.find(stockcheck.check_by)
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
checker = Employee.find_by_id_and_shop_code(stockcheck.check_by,@shop.shop_code)
|
||||
print_settings = PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code)
|
||||
if !print_settings.nil?
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_stock_check_result(print_settings, stockcheck, stockcheck_items, checker.name, shop_details)
|
||||
printer.print_stock_check_result(print_settings, stockcheck, stockcheck_items, checker.name, @shop)
|
||||
end
|
||||
end
|
||||
|
||||
def get_menu_category ()
|
||||
if (params[:id])
|
||||
|
||||
|
||||
#Pull this menu
|
||||
@menu_category = InventoryDefinition.search_by_category(params[:id])
|
||||
puts @menu_category.to_json
|
||||
|
||||
Reference in New Issue
Block a user