From 8e2a9bd5a11a726ff0d51a5a5e5c0b904bf144b3 Mon Sep 17 00:00:00 2001 From: Myat Zin Wai Maw Date: Fri, 13 Sep 2019 16:20:54 +0630 Subject: [PATCH] add to existing --- app/controllers/origami/sales_controller.rb | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/app/controllers/origami/sales_controller.rb b/app/controllers/origami/sales_controller.rb index 0549a5a5..4c02a4f0 100755 --- a/app/controllers/origami/sales_controller.rb +++ b/app/controllers/origami/sales_controller.rb @@ -29,11 +29,8 @@ class Origami::SalesController < BaseOrigamiController sale_data = [] table = DiningFacility.find(dining) existing_booking = Booking.find_by_sale_id(sale_id) - table.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ").each do |booking| - # if !booking.checkout_at.nil? - # existing_booking.update_attributes(checkout_at: checkout_at) - # end - if booking.sale_id.nil? + table.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ").each do |booking| + if booking.sale_id.nil? order_array = [] booking.booking_orders.each do |booking_order| @@ -60,8 +57,7 @@ class Origami::SalesController < BaseOrigamiController booking.save order_array.push(order.order_id) - - end + end receipt_no = Sale.find(sale_id).receipt_no action_by = current_user.name @@ -77,10 +73,6 @@ class Origami::SalesController < BaseOrigamiController end end end - # if !sale_data.empty? - # InventoryJob.perform_now(self.id) - # InventoryDefinition.calculate_product_count(nil,sale_data) - end end -end +end \ No newline at end of file