class Origami::RoomInvoicesController < ApplicationController #BaseOrigamiController def index @room = DiningFacility.find(params[:room_id]) puts "room bookig lenght" @sale_array = Array.new @room.bookings.each do |booking| puts booking.sale_id if booking.sale_id.nil? else sale = Sale.find(booking.sale_id) if sale.sale_status != "completed" @sale_array.push(sale) end end end end def show @room = DiningFacility.find(params[:room_id]) @sale_array = Array.new @room.bookings.each do |booking| if booking.sale_id.nil? else sale = Sale.find(booking.sale_id) if sale.sale_status != "completed" @sale_array.push(sale) end end end @sale = Sale.find(params[:invoice_id]) @date = @sale.created_at @status_sale = 'sale' @customer = @sale.customer end end