update payment controller for print current user with terminal
This commit is contained in:
@@ -145,17 +145,23 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
# For Cashier by Zone
|
# For Cashier by Zone
|
||||||
# bookings = Booking.where("sale_id='#{sale_id}'")
|
# bookings = Booking.where("sale_id='#{sale_id}'")
|
||||||
bookings = Booking.find_by_sale_id(sale_id)
|
bookings = Booking.find_by_sale_id(sale_id)
|
||||||
if bookings.dining_facility_id.to_i > 0
|
|
||||||
table = DiningFacility.find(bookings.dining_facility_id)
|
|
||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
|
||||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
|
||||||
|
|
||||||
type = 'payment'
|
shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
from = getCloudDomain #get sub domain in cloud mode
|
if !shift.nil?
|
||||||
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
|
||||||
else
|
|
||||||
shift = ShiftSale.find(saleObj.shift_sale_id)
|
|
||||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||||
|
else
|
||||||
|
if bookings.dining_facility_id.to_i > 0
|
||||||
|
table = DiningFacility.find(bookings.dining_facility_id)
|
||||||
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||||
|
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||||
|
|
||||||
|
type = 'payment'
|
||||||
|
from = getCloudDomain #get sub domain in cloud mode
|
||||||
|
ActionCable.server.broadcast "order_channel",table: table,type:type,from:from
|
||||||
|
else
|
||||||
|
shift = ShiftSale.find(saleObj.shift_sale_id)
|
||||||
|
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# For Print
|
# For Print
|
||||||
@@ -447,14 +453,18 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
# else
|
# else
|
||||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||||
# end
|
# end
|
||||||
|
shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
if bookings[0].dining_facility_id.to_i > 0
|
if !shift.nil?
|
||||||
|
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||||
|
else
|
||||||
|
if bookings[0].dining_facility_id.to_i > 0
|
||||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||||
else
|
else
|
||||||
shift = ShiftSale.find(saleObj.shift_sale_id)
|
shift = ShiftSale.find(saleObj.shift_sale_id)
|
||||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
@@ -555,21 +565,20 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
# For Cashier by Zone
|
# For Cashier by Zone
|
||||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||||
# if bookings.count > 1
|
|
||||||
# # for Multiple Booking
|
|
||||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
|
||||||
# else
|
|
||||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
|
||||||
# end
|
|
||||||
if bookings[0].dining_facility_id.to_i > 0
|
|
||||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
|
||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
|
||||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
|
||||||
else
|
|
||||||
shift = ShiftSale.find(saleObj.shift_sale_id)
|
|
||||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
|
if !shift.nil?
|
||||||
|
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||||
|
else
|
||||||
|
if bookings[0].dining_facility_id.to_i > 0
|
||||||
|
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||||
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||||
|
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||||
|
else
|
||||||
|
shift = ShiftSale.find(saleObj.shift_sale_id)
|
||||||
|
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Re-call Sale Data
|
# Re-call Sale Data
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user