class Origami::MoveroomController < BaseOrigamiController authorize_resource :class => false def move_dining @webview = check_mobile @tables = Table.all.active.order('status desc') @rooms = Room.all.active.order('status desc') @complete = Sale.where("DATE_FORMAT(CONVERT_TZ(created_at, '+00:00', '<%= Time.zone.formatted_offset %>'), '%Y-%m-%d') = ? and sale_status != 'new'",Time.current.strftime('%Y-%m-%d')) @orders = Order.where("DATE_FORMAT(CONVERT_TZ(created_at, '+00:00', '<%= Time.zone.formatted_offset %>'), '%Y-%m-%d') = ? and status != 'billed'",Time.current.strftime('%Y-%m-%d')).order('date desc') @status_order = "" @status_sale = "" @sale_array = Array.new @dining = DiningFacility.find(params[:dining_id]) @dining_room = @dining.bookings.active.where("DATE_FORMAT(CONVERT_TZ(created_at, '+00:00', '<%= Time.zone.formatted_offset %>'), '%Y-%m-%d') = '#{Time.current.strftime('%Y-%m-%d')}' OR DATE_FORMAT(CONVERT_TZ(created_at, '+00:00', '<%= Time.zone.formatted_offset %>'), '%Y-%m-%d') = '#{Date.current.prev_day}' ") @dining_room.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_by_id(acc) if !account.nil? @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_by_id(acc) # @account_arr.push(account) # end # end end end end end