shop code missing
This commit is contained in:
@@ -2057,13 +2057,13 @@ end
|
||||
query = query.where("bookings.booking_status = 'assign' AND orders.status = 'new' AND orders.source =? ","#{type}")
|
||||
.group("bookings.booking_id")
|
||||
end
|
||||
def self.completed_sale(type,shop_code)
|
||||
def self.completed_sale(type)
|
||||
if type == "cashier"
|
||||
type = "and orders.source = 'emenu' or orders.source = 'cashier'"
|
||||
else
|
||||
type = "and orders.source = '#{type}'"
|
||||
end
|
||||
query = Sale.where("sales.shop_code='#{shop_code}'")
|
||||
query = Sale.where("sales.shop_code='#{Shop.current_shop.shop_code}'")
|
||||
query = query.joins("join sale_orders as sale_orders on sale_orders.sale_id = sales.sale_id")
|
||||
.joins("join orders as orders on orders.order_id = sale_orders.order_id")
|
||||
query = query.where("sales.sale_status != 'new' AND orders.status = 'billed' #{type}")
|
||||
@@ -2456,7 +2456,7 @@ private
|
||||
def update_stock_journal
|
||||
if self.sale_status == "void" && self.sale_status_before_last_save != "void"
|
||||
self.sale_items.each do |item|
|
||||
found, inventory_definition = InventoryDefinition.find_product_in_inventory(item,self.shop_code)
|
||||
found, inventory_definition = InventoryDefinition.find_product_in_inventory(item)
|
||||
if found
|
||||
stock = StockJournal.where('item_code=?', item.item_instance_code).order("id DESC").first
|
||||
unless stock.nil?
|
||||
@@ -2469,7 +2469,7 @@ private
|
||||
end
|
||||
elsif self.sale_status == "waste" || self.sale_status == "spoile" || (self.payment_status == "foc" && self.payment_status_was != "foc")
|
||||
self.bookings.first.order_items.each do |item|
|
||||
found, inventory_definition = InventoryDefinition.find_product_in_inventory(item,self.shop_code)
|
||||
found, inventory_definition = InventoryDefinition.find_product_in_inventory(item)
|
||||
if found
|
||||
if stock_journal = StockJournal.find_by_trans_ref(item.order_items_id)
|
||||
if self.payment_status == "foc" && self.payment_status_was != "foc"
|
||||
|
||||
Reference in New Issue
Block a user