26 lines
756 B
Ruby
26 lines
756 B
Ruby
class Api::Foodcourt::BillsController < Api::ApiController
|
|
|
|
def create
|
|
Sale.transaction do
|
|
if shift = ShiftSale.current_open_shift(current_login_employee)
|
|
if @booking = Booking.find(params[:booking_id])
|
|
cashier = Employee.find(shift.employee_id)
|
|
order = @booking.orders.first
|
|
|
|
if @sale_data = @booking.sale
|
|
@status = true
|
|
elsif @sale_data = Sale.generate_invoice_from_booking(@booking, current_login_employee, cashier, order.source, params[:current_checkin_induties_count])
|
|
@status = true
|
|
else
|
|
@status = false
|
|
end
|
|
end
|
|
else
|
|
@status = false
|
|
@error_message = "No Current Open Shift"
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|