update bill for multiple zone

This commit is contained in:
Aung Myo
2018-08-06 17:46:27 +06:30
parent f0f19edcd6
commit b933f959f6

View File

@@ -18,8 +18,26 @@ class Api::BillController < Api::ApiController
order = Order.find(bk_order.order_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
cashier = Employee.find(shift.employee_id)
if !shift.nil?
cashier = Employee.find(shift.employee_id)
else
multiple_zone = CashierTerminalByZone.where('zone_id = #{cashier_zone.zone_id}')
puts cashier_zone.to_json
puts "cashier_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
puts shift.to_json
puts "shift"
if !shift.nil? then
cashier = Employee.find(shift.employee_id)
break
end
end
end
if booking
if booking.sale_id.nil?