diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb index 3fa36f7d..96caf298 100644 --- a/app/controllers/origami/split_bill_controller.rb +++ b/app/controllers/origami/split_bill_controller.rb @@ -82,14 +82,16 @@ class Origami::SplitBillController < BaseOrigamiController order.guest_info = nil order.save + BookingOrder.create({:booking_id => booking.booking_id, :order_id => order.order_id}) + order_items.each do |order_item| - orderItem = OrderItem.find(order_item.order_items_id) + orderItem = OrderItem.find(order_item["id"]) orderItem.order_id = order.order_id orderItem.save end 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(booking.booking_id, current_user, get_cashier_by_terminal) sale_data = Sale.find_by_sale_id(sale_id) end diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index ed1b9170..eb7e3e94 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -398,6 +398,7 @@ class SalePayment < ApplicationRecord end else status = false + sale_count += 1 end end end