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
|
||||
# bookings = Booking.where("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'
|
||||
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)
|
||||
|
||||
shift = ShiftSale.current_open_shift(current_user.id)
|
||||
if !shift.nil?
|
||||
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
|
||||
|
||||
# For Print
|
||||
@@ -447,15 +453,19 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
# else
|
||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
# end
|
||||
|
||||
if bookings[0].dining_facility_id.to_i > 0
|
||||
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
|
||||
else
|
||||
shift = ShiftSale.find(saleObj.shift_sale_id)
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
end
|
||||
end
|
||||
|
||||
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf
|
||||
@@ -555,22 +565,21 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
# For Cashier by Zone
|
||||
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
|
||||
saleObj = Sale.find(sale_id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user