diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb
index 84a46622..dc61f7fb 100644
--- a/app/controllers/origami/home_controller.rb
+++ b/app/controllers/origami/home_controller.rb
@@ -4,7 +4,7 @@ class Origami::HomeController < BaseOrigamiController
def index
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
- @complete = Sale.all
+ @complete = Sale.complete_sale
@orders = Order.all.order('date desc')
end
@@ -12,15 +12,15 @@ class Origami::HomeController < BaseOrigamiController
def show
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
- @complete = Sale.all
+ @complete = Sale.complete_sale
@orders = Order.all.order('date desc')
@status_order = ""
- @order_items = Array.new
+ @status_sale = ""
+ @sale_array = Array.new
@dining.bookings.each do |booking|
-
if booking.sale_id.nil?
-
booking.booking_orders.each do |booking_order|
+ @order_items = Array.new
order = Order.find(booking_order.order_id)
@obj_order = order
@date = order.created_at
@@ -32,6 +32,7 @@ class Origami::HomeController < BaseOrigamiController
else
sale = Sale.find(booking.sale_id)
if sale.sale_status != "completed"
+ @sale_array.push(sale)
if @status_order == 'order'
@status_order = 'sale'
end
diff --git a/app/controllers/origami/orders_controller.rb b/app/controllers/origami/orders_controller.rb
index cc5fac3f..e5eb2808 100644
--- a/app/controllers/origami/orders_controller.rb
+++ b/app/controllers/origami/orders_controller.rb
@@ -3,7 +3,7 @@ class Origami::OrdersController < BaseOrigamiController
def show
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
- @complete = Sale.all
+ @complete = Sale.complete_sale
@orders = Order.all.order('status desc')
@order = Order.find(params[:order_id])
sale_order = SaleOrder.find_by_order_id(@order.order_id)
diff --git a/app/controllers/origami/rooms_controller.rb b/app/controllers/origami/rooms_controller.rb
index 1ac7f41a..56030d4f 100644
--- a/app/controllers/origami/rooms_controller.rb
+++ b/app/controllers/origami/rooms_controller.rb
@@ -3,7 +3,7 @@ class Origami::RoomsController < BaseOrigamiController
def show
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
- @complete = Sale.all
+ @complete = Sale.complete_sale
@orders = Order.all.order('date desc')
@room = DiningFacility.find(params[:room_id])
@room.bookings.each do |booking|
diff --git a/app/controllers/origami/sales_controller.rb b/app/controllers/origami/sales_controller.rb
index e9eb2edc..b5200114 100644
--- a/app/controllers/origami/sales_controller.rb
+++ b/app/controllers/origami/sales_controller.rb
@@ -3,7 +3,7 @@ class Origami::SalesController < BaseOrigamiController
def show
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
- @complete = Sale.all
+ @complete = Sale.complete_sale
@orders = Order.all.order('date desc')
@sale = Sale.find(params[:sale_id])
end
diff --git a/app/models/booking.rb b/app/models/booking.rb
index 2b3905ae..4aa177fc 100644
--- a/app/models/booking.rb
+++ b/app/models/booking.rb
@@ -15,19 +15,19 @@ class Booking < ApplicationRecord
booking.dining_facility_id = newd
booking.save
end
- table = DiningFacility.find(newd)
- if table
- booking = table.get_current_booking
- if booking
- newtablebookingID= booking.booking_id
- booking_arr.each do |booking|
- booking.booking_orders.each do |booking_order|
- booking_order.booking_id = newtablebookingID
- booking_order.save
- end
- end
- end
- end
+ # table = DiningFacility.find(newd)
+ # if table
+ # booking = table.get_current_booking
+ # if booking
+ # newtablebookingID= booking.booking_id
+ # booking_arr.each do |booking|
+ # booking.booking_orders.each do |booking_order|
+ # booking_order.booking_id = newtablebookingID
+ # booking_order.save
+ # end
+ # end
+ # end
+ # end
new_dining = DiningFacility.find(newd)
new_dining.make_occupied
old_dining = DiningFacility.find(old)
diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb
index 9ce6bdfc..d1629a04 100644
--- a/app/views/origami/home/show.html.erb
+++ b/app/views/origami/home/show.html.erb
@@ -97,7 +97,7 @@
diff --git a/app/views/origami/movetable/move_dining.html.erb b/app/views/origami/movetable/move_dining.html.erb
index 2e03aaa2..7874f42b 100644
--- a/app/views/origami/movetable/move_dining.html.erb
+++ b/app/views/origami/movetable/move_dining.html.erb
@@ -99,6 +99,7 @@
+ | # |
Items |
QTY
| Price
@@ -106,14 +107,17 @@
|
<%
+ count = 0
sub_total = 0
if @status_sale == "sale"
@obj_sale.sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price
+ count += 1
%>
<% unless sale_item.price <= 0 %>
+ | <%= count %> |
<%= sale_item.product_name %> |
<%= sale_item.qty %> |
<%= sale_item.price %> |
@@ -122,14 +126,15 @@
end
end
end
-
- if @status_order == 'order'
+ count = 0
+ if @status_order == 'order' && @status_sale != 'sale'
unless @order_items.nil?
@order_items.each do |order_item |
sub_total = sub_total + order_item.price
-
+ count += 1
unless order_item.price <= 0 %>
+ | <%= count %> |
<%= order_item.item_name %> |
<%= order_item.qty %> |
<%= order_item.qty*order_item.price %> |
@@ -150,10 +155,13 @@
Pending New Order
<%
+ count = 0
@order_items.each do |order_item |
+ count += 1
%>
+ | <%= count %> |
<%= order_item.item_name %> |
<%= order_item.qty %> |
<%= order_item.qty*order_item.price %> |