shift update
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -3,7 +3,7 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
def check_in_time
|
||||
if params[:dining_id]
|
||||
dining_facility = DiningFacility.find(params[:dining_id])
|
||||
booking = dining_facility.get_current_checkout_booking
|
||||
booking = dining_facility.get_current_booking
|
||||
if !booking.nil?
|
||||
check_in_time = booking.checkin_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
||||
check_out_time = booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M")
|
||||
|
||||
@@ -115,7 +115,7 @@ class Sale < ApplicationRecord
|
||||
|
||||
booking.sale_id = self.id
|
||||
booking.checkout_at = Time.now.utc.getlocal
|
||||
booking.checkout_by = requested_by.name
|
||||
# booking.checkout_by = requested_by.name
|
||||
booking.save
|
||||
|
||||
InventoryJob.perform_now(self.id)
|
||||
|
||||
@@ -282,7 +282,7 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
end
|
||||
|
||||
def sale_update_payment_status(paid_amount)
|
||||
def sale_update_payment_status(paid_amount)
|
||||
#update amount_outstanding
|
||||
self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f
|
||||
self.sale.save!
|
||||
|
||||
Reference in New Issue
Block a user