add multi cashier logic

This commit is contained in:
Yan
2017-10-23 18:10:15 +06:30
parent 857ab0ae14
commit 707cae4cf8
2 changed files with 8 additions and 3 deletions

View File

@@ -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

View File

@@ -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