conflic data
This commit is contained in:
@@ -3,7 +3,7 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@orders = Order.all.order('date desc')
|
||||
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
# @shift = ShiftSale.current_open_shift(current_user.id)
|
||||
end
|
||||
|
||||
@@ -11,7 +11,7 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@orders = Order.all.order('date desc')
|
||||
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
|
||||
@room = DiningFacility.find(params[:room_id])
|
||||
|
||||
@@ -22,6 +22,32 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
@shop = Shop::ShopDetail
|
||||
@membership = MembershipSetting::MembershipSetting
|
||||
@payment_methods = PaymentMethodSetting.all
|
||||
|
||||
@order_items_count = Hash.new
|
||||
bookings = Booking.all
|
||||
if !bookings.nil?
|
||||
bookings.each do |booking|
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
if !booking.booking_orders.empty?
|
||||
booking.booking_orders.each do |booking_order|
|
||||
order = Order.find(booking_order.order_id)
|
||||
if !order.order_items.empty?
|
||||
if !@order_items_count.key?(booking.dining_facility_id)
|
||||
@order_items_count.store(booking.dining_facility_id, order.order_items.count)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
sale = Sale.find(booking.sale_id)
|
||||
if sale.sale_status !='completed'
|
||||
if !@order_items_count.key?(booking.dining_facility_id)
|
||||
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@room.bookings.active.each do |booking|
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
|
||||
Reference in New Issue
Block a user