diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb index 88828d1b..e7265a7a 100644 --- a/app/controllers/origami/split_bill_controller.rb +++ b/app/controllers/origami/split_bill_controller.rb @@ -106,7 +106,7 @@ class Origami::SplitBillController < BaseOrigamiController if booking if booking.sale_id.nil? sale = Sale.new - status, sale_id = sale.generate_invoice_from_booking(params[:booking_id], current_user, get_cashier_by_terminal) + status, sale_id = sale.generate_invoice_from_booking(params[:booking_id], current_user, current_user) sale_data = Sale.find_by_sale_id(sale_id) else status = true @@ -127,6 +127,7 @@ class Origami::SplitBillController < BaseOrigamiController if !orders.nil? orders.each do |order| + BookingOrder.find_by_order_id(order["id"]).delete BookingOrder.create({:booking_id => booking.booking_id, :order_id => order["id"]}) end elsif !order_items.nil? @@ -193,6 +194,8 @@ class Origami::SplitBillController < BaseOrigamiController end end + puts new_order_status + if new_order_status BookingOrder.find_by_order_id(odr_id).delete BookingOrder.create({:booking_id => booking.booking_id, :order_id => odr_id}) @@ -232,6 +235,8 @@ class Origami::SplitBillController < BaseOrigamiController end end + puts new_order_status + if new_order_status BookingOrder.find_by_order_id(order_id).delete BookingOrder.create({:booking_id => booking.booking_id, :order_id => order_id}) @@ -326,7 +331,6 @@ class Origami::SplitBillController < BaseOrigamiController instance_item_sets = JSON.parse(orderItem.set_menu_items) instance_item_sets.each_with_index do |instance_item, instance_index| instance_item_sets[instance_index]["quantity"] = (instance_item["quantity"].to_i - order_item['qty'].to_i).to_s - "[{\"item_instance_code\":\"psi002in001\",\"quantity\":\"2\",\"price\":\"5500.0\"}]" set_menu_items_obj.push({'item_instance_code' => instance_item["item_instance_code"], 'quantity' => order_item['qty'].to_i, 'price' => instance_item["price"]}) end orderItem.set_menu_items = instance_item_sets.to_json diff --git a/app/views/origami/split_bill/index.html.erb b/app/views/origami/split_bill/index.html.erb index a423f298..72f08c83 100755 --- a/app/views/origami/split_bill/index.html.erb +++ b/app/views/origami/split_bill/index.html.erb @@ -229,8 +229,10 @@