conflic data

This commit is contained in:
San Wai Lwin
2018-02-09 10:17:56 +06:30
parent 625ee9bd34
commit 860e8db202
29 changed files with 622 additions and 296 deletions

View File

@@ -3,7 +3,7 @@ class Origami::OrdersController < 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('status desc')
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@order = Order.find(params[:order_id])
sale_order = SaleOrder.find_by_order_id(@order.order_id)
if sale_order
@@ -12,6 +12,32 @@ class Origami::OrdersController < BaseOrigamiController
@sale_status = sale.sale_status
end
end
@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
end
#Shop Name in Navbor