shift update

This commit is contained in:
Yan
2017-12-07 12:07:06 +06:30
parent 04b27489dd
commit 69b786a91d
4 changed files with 12 additions and 4 deletions

View File

@@ -5,7 +5,8 @@ class Api::BillController < Api::ApiController
def create
@status = false
@error_message = "Order ID or Booking ID is require to request for a bill."
if ShiftSale.current_shift
if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
#create Bill by Booking ID
table = 0
if (params[:booking_id])
@@ -22,9 +23,11 @@ class Api::BillController < Api::ApiController
if booking.sale_id.nil?
@sale = Sale.new
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, get_cashier_by_terminal)
@sale_data = Sale.find_by_sale_id(@sale_id)
else
@status = true
@sale_id = booking.sale_id
@sale_data = Sale.find_by_sale_id(@sale_id)
end
end
@@ -36,6 +39,11 @@ class Api::BillController < Api::ApiController
booking = Booking.find_by_sale_id(@sale_id)
table = DiningFacility.find(booking.dining_facility_id)
end
# Bind shift sale id to sale
@sale_data.shift_sale_id = shift_by_terminal.id
@sale_data.save
Promotion.promo_activate(@sale)
BillBroadcastJob.perform_later(table)