update multiple zone with terminal
This commit is contained in:
@@ -18,24 +18,20 @@ class Api::BillController < Api::ApiController
|
|||||||
order = Order.find(bk_order.order_id)
|
order = Order.find(bk_order.order_id)
|
||||||
|
|
||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||||
puts cashier_zone.to_json
|
|
||||||
puts "cashier_zone"
|
|
||||||
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and cashier_terminal_id = #{cashier_zone.cashier_terminal_id}").first
|
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and cashier_terminal_id = #{cashier_zone.cashier_terminal_id}").first
|
||||||
|
|
||||||
|
#for multiple zone with terminal
|
||||||
if !shift.nil?
|
if !shift.nil?
|
||||||
cashier = Employee.find(shift.employee_id)
|
cashier = Employee.find(shift.employee_id)
|
||||||
else
|
else
|
||||||
multiple_zone = CashierTerminalByZone.where('zone_id = #{cashier_zone.zone_id}')
|
multiple_zone = CashierTerminalByZone.where("zone_id = #{table.zone_id}")
|
||||||
puts cashier_zone.to_json
|
|
||||||
puts "cashier_zone"
|
|
||||||
multiple_zone.each do |zone|
|
multiple_zone.each do |zone|
|
||||||
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and cashier_terminal_id = #{zone.cashier_terminal_id}").first
|
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and cashier_terminal_id = #{zone.cashier_terminal_id}").first
|
||||||
puts shift.to_json
|
if !shift.nil? then
|
||||||
puts "shift"
|
cashier = Employee.find(shift.employee_id)
|
||||||
if !shift.nil? then
|
|
||||||
cashier = Employee.find(shift.employee_id)
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,17 @@ class Sale < ApplicationRecord
|
|||||||
table = DiningFacility.find(booking.dining_facility_id)
|
table = DiningFacility.find(booking.dining_facility_id)
|
||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||||
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and cashier_terminal_id = #{cashier_zone.cashier_terminal_id}").first
|
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and cashier_terminal_id = #{cashier_zone.cashier_terminal_id}").first
|
||||||
|
#for multiple zone with terminal
|
||||||
|
if shift.nil?
|
||||||
|
multiple_zone = CashierTerminalByZone.where("zone_id = #{table.zone_id}")
|
||||||
|
multiple_zone.each do |zone|
|
||||||
|
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and cashier_terminal_id = #{zone.cashier_terminal_id}").first
|
||||||
|
if !shift.nil? then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
||||||
current_shift = ShiftSale.current_shift
|
current_shift = ShiftSale.current_shift
|
||||||
|
|||||||
Reference in New Issue
Block a user