diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index ad135e03..eaf3bab7 100755 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -35,19 +35,21 @@ class Origami::HomeController < BaseOrigamiController @shop = shop_detail @membership = MembershipSetting::MembershipSetting @payment_methods = PaymentMethodSetting.all - @dining_booking = @dining.current_bookings @order_items = Array.new - @dining_booking.each do |booking| + @dining.current_bookings.each do |booking| if @obj_sale || @booking.blank? @booking = booking end if booking.sale_id - @obj_sale = booking.sale - @sale_array.push(@obj_sale) - @sale_taxes = @obj_sale.sale_taxes - @status_sale = 'sale' + @sale_array.push(booking.sale) + + if @obj_sale.blank? + @obj_sale = booking.sale + @sale_taxes = @obj_sale.sale_taxes + @status_sale = 'sale' + end else @order_items += booking.order_items @obj_order = booking.orders.first diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index b49523d6..7e92ac0d 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -239,7 +239,7 @@
<%= @sale_array[0].customer_id rescue '' %>
- Customer : <%= @sale_array[0].customer.name rescue '' %> +<%= @obj_sale.customer_id rescue '' %>
+ Customer : <%= @obj_sale.customer.name rescue '' %> <% elsif @status_order == 'order' %><%= @customer.customer_id rescue "" %>
@@ -291,9 +291,9 @@ <% count = 0 sub_total = 0 if @status_sale == "sale" - @sale_array[0].sale_items.each do |sale_item| + @obj_sale.sale_items.each do |sale_item| sub_total = sub_total + sale_item.price%> - + <%count += 1 %>