Multiple Invoices Phase 1

This commit is contained in:
Phyo
2017-06-26 11:10:49 +06:30
parent 4958cb6872
commit 6e49f91b89
8 changed files with 557 additions and 7 deletions

View File

@@ -0,0 +1,40 @@
class Origami::TableInvoicesController < BaseOrigamiController
def index
@table = DiningFacility.find(params[:table_id])
puts "table bookig lenght"
@sale_array = Array.new
@table.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
@table = DiningFacility.find(params[:table_id])
@sale_array = Array.new
@table.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