add multi cashier logic
This commit is contained in:
@@ -13,10 +13,15 @@ class Api::BillController < Api::ApiController
|
||||
# for Job
|
||||
table = DiningFacility.find(booking.dining_facility_id)
|
||||
|
||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||
|
||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id(cashier_zone.cashier_terminal_id)
|
||||
get_cashier_by_terminal = Employee.find(shift_by_terminal.employee_id)
|
||||
|
||||
if booking
|
||||
if booking.sale_id.nil?
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, get_cashier)
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, get_cashier_by_terminal)
|
||||
else
|
||||
@status = true
|
||||
@sale_id = booking.sale_id
|
||||
|
||||
@@ -71,8 +71,8 @@ class Sale < ApplicationRecord
|
||||
|
||||
# set cashier
|
||||
if cashier != nil
|
||||
self.cashier_id = cashier[0].id
|
||||
self.cashier_name = cashier[0].name
|
||||
self.cashier_id = cashier.id
|
||||
self.cashier_name = cashier.name
|
||||
else
|
||||
self.cashier_id = requested_by.id
|
||||
self.cashier_name = requested_by.name
|
||||
|
||||
Reference in New Issue
Block a user