Pull from master
This commit is contained in:
@@ -7,8 +7,8 @@ class Origami::MoveroomController < BaseOrigamiController
|
||||
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
@orders = Order.all.order('date desc')
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
|
||||
@status_order = ""
|
||||
@status_sale = ""
|
||||
@@ -34,25 +34,25 @@ class Origami::MoveroomController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
@status_order = 'order'
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status != "completed" && sale.sale_status != "waste" && sale.sale_status != "spoile"
|
||||
@sale_array.push(sale)
|
||||
if @status_order == 'order'
|
||||
@status_order = 'sale'
|
||||
end
|
||||
@booking= booking
|
||||
@date = sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@obj_sale = sale
|
||||
@customer = sale.customer
|
||||
accounts = @customer.tax_profiles
|
||||
@account_arr =[]
|
||||
accounts.each do |acc|
|
||||
account = TaxProfile.find(acc)
|
||||
@account_arr.push(account)
|
||||
end
|
||||
end
|
||||
# else
|
||||
# sale = Sale.find(booking.sale_id)
|
||||
# if sale.sale_status != "completed" && sale.sale_status != "waste" && sale.sale_status != "spoile"
|
||||
# @sale_array.push(sale)
|
||||
# if @status_order == 'order'
|
||||
# @status_order = 'sale'
|
||||
# end
|
||||
# @booking= booking
|
||||
# @date = sale.created_at
|
||||
# @status_sale = 'sale'
|
||||
# @obj_sale = sale
|
||||
# @customer = sale.customer
|
||||
# accounts = @customer.tax_profiles
|
||||
# @account_arr =[]
|
||||
# accounts.each do |acc|
|
||||
# account = TaxProfile.find(acc)
|
||||
# @account_arr.push(account)
|
||||
# end
|
||||
# end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,52 +7,74 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.all
|
||||
@orders = Order.all.order('date desc')
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
@dining = DiningFacility.find(params[:dining_id])
|
||||
|
||||
@status_order = ""
|
||||
@status_sale = ""
|
||||
@sale_array = Array.new
|
||||
|
||||
# if !bookings.nil?
|
||||
# bookings.each do | booking |
|
||||
# if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
# booking_array.push(booking)
|
||||
# end
|
||||
|
||||
# booking.booking_orders.each do |booking_order|
|
||||
# order = Order.find(booking_order.order_id)
|
||||
# if order.status == 'new'
|
||||
# order.order_items.each do |order_item|
|
||||
# order_items.push(order_item)
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
@dining.bookings.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
@order_items = Array.new
|
||||
booking.booking_orders.each do |booking_order|
|
||||
order = Order.find(booking_order.order_id)
|
||||
@obj_order = order
|
||||
@customer = order.customer
|
||||
@date = order.created_at
|
||||
@booking= booking
|
||||
order.order_items.each do |item|
|
||||
@order_items.push(item)
|
||||
end
|
||||
accounts = @customer.tax_profiles
|
||||
@account_arr =[]
|
||||
accounts.each do |acc|
|
||||
account = TaxProfile.find(acc)
|
||||
@account_arr.push(account)
|
||||
end
|
||||
end
|
||||
if booking.booking_status != 'moved'
|
||||
booking.booking_orders.each do |booking_order|
|
||||
order = Order.find(booking_order.order_id)
|
||||
@obj_order = order
|
||||
@customer = order.customer
|
||||
@date = order.created_at
|
||||
@booking= booking
|
||||
if order.status == 'new'
|
||||
order.order_items.each do |item|
|
||||
@order_items.push(item)
|
||||
end
|
||||
end
|
||||
|
||||
accounts = @customer.tax_profiles
|
||||
@account_arr =[]
|
||||
accounts.each do |acc|
|
||||
account = TaxProfile.find(acc)
|
||||
@account_arr.push(account)
|
||||
end
|
||||
end
|
||||
end
|
||||
@status_order = 'order'
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status != "completed" && sale.sale_status != "waste" && sale.sale_status != "spoile"
|
||||
@sale_array.push(sale)
|
||||
if @status_order == 'order'
|
||||
@status_order = 'sale'
|
||||
end
|
||||
@booking= booking
|
||||
@date = sale.created_at
|
||||
@status_sale = 'sale'
|
||||
@obj_sale = sale
|
||||
@customer = sale.customer
|
||||
accounts = @customer.tax_profiles
|
||||
@account_arr =[]
|
||||
accounts.each do |acc|
|
||||
account = TaxProfile.find(acc)
|
||||
@account_arr.push(account)
|
||||
end
|
||||
end
|
||||
# else
|
||||
# sale = Sale.find(booking.sale_id)
|
||||
# if sale.sale_status != "completed" && sale.sale_status != "waste" && sale.sale_status != "spoile"
|
||||
# @sale_array.push(sale)
|
||||
# if @status_order == 'order'
|
||||
# @status_order = 'sale'
|
||||
# end
|
||||
# @booking= booking
|
||||
# @date = sale.created_at
|
||||
# @status_sale = 'sale'
|
||||
# @obj_sale = sale
|
||||
# @customer = sale.customer
|
||||
# accounts = @customer.tax_profiles
|
||||
# @account_arr =[]
|
||||
# accounts.each do |acc|
|
||||
# account = TaxProfile.find(acc)
|
||||
# @account_arr.push(account)
|
||||
# end
|
||||
# end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -104,6 +126,20 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
printer.print_move_table(print_settings,@to,@from ,@shop,@date,@type,@moved_by,order_items)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
type = 'move'
|
||||
from = getCloudDomain #get sub domain in cloud mode
|
||||
ActionCable.server.broadcast "order_channel",table: change_from,type:type,from:from ,change_to:change_to
|
||||
end
|
||||
|
||||
#get cloud domain
|
||||
def getCloudDomain
|
||||
from = ""
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain + "." + request.domain
|
||||
end
|
||||
|
||||
return from
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user