fix timezone

This commit is contained in:
Thein Lin Kyaw
2023-02-09 14:55:43 +06:30
parent c580cc731a
commit 944f7a7259
52 changed files with 238 additions and 236 deletions

View File

@@ -7,15 +7,15 @@ class Origami::MovetableController < BaseOrigamiController
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@complete = Sale.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and sale_status != 'new'",Time.current.strftime('%Y-%m-%d'))
@orders = Order.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status != 'billed'",Time.current.strftime('%Y-%m-%d')).order('date desc')
@dining = DiningFacility.find(params[:dining_id])
@status_order = ""
@status_sale = ""
@sale_array = Array.new
@dining_booking = @dining.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.current.prev_day}' ")
@dining_booking = @dining.bookings.active.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = '#{Time.current.strftime('%Y-%m-%d')}' OR DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = '#{Date.current.prev_day}' ")
@dining_booking.each do |booking|
if booking.sale_id.nil?
@@ -32,7 +32,7 @@ class Origami::MovetableController < BaseOrigamiController
@order_items.push(item)
end
end
accounts = @customer.tax_profiles
@account_arr =[]
accounts.each do |acc|
@@ -69,11 +69,11 @@ class Origami::MovetableController < BaseOrigamiController
def moving
change_to = params[:change_to] #new
change_from = params[:change_from] #original
change_from = params[:change_from] #original
# bookings = Booking.where('dining_facility_id=?',change_from)
bookings = Booking.where("((DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.current.prev_day}')) AND dining_facility_id='#{change_from}'")
bookings = Booking.where("((DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = '#{Time.current.strftime('%Y-%m-%d')}' OR DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = '#{Date.current.prev_day}')) AND dining_facility_id='#{change_from}'")
booking_array = Array.new
order_items = Array.new
@@ -85,13 +85,13 @@ class Origami::MovetableController < BaseOrigamiController
booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id)
if order.status == 'new'
if order.status == 'new'
oqs = OrderQueueStation.new
oqs.process_order(order, change_from, order.source, 'move',change_to,current_user.name)
# order.order_items.each do |order_item|
# order_items.push(order_item)
# end
end
end
end
end
end
@@ -104,9 +104,9 @@ class Origami::MovetableController < BaseOrigamiController
# @to = (DiningFacility.find(change_to)).name
# @type = (DiningFacility.find(change_to)).type
# @moved_by = @current_user.name
# @date = DateTime.now
# @date = Time.current
# @shop = @shop
# unique_code = "MoveTablePdf"
# unique_code = "MoveTablePdf"
# pdf_no = PrintSetting.where(:unique_code => unique_code).count
# #print_settings = PrintSetting.find_by_unique_code(unique_code)
# printer_array = []
@@ -115,15 +115,15 @@ class Origami::MovetableController < BaseOrigamiController
# for i in 0..pdf_no
# if i != pdf_no
# print_settings = printer_array[i]
# printer = Printer::ReceiptPrinter.new(print_settings)
# printer = Printer::ReceiptPrinter.new(print_settings)
# printer.print_move_table(print_settings,@to,@from ,@shop,@date,@type,@moved_by,order_items)
# end
# end
# end
# end
# end
type = 'move'
from = getCloudDomain #get sub domain in cloud mode
ActionCable.server.broadcast "order_channel",table: change_from,type:type,from:from ,change_to:change_to
ActionCable.server.broadcast "order_channel",table: change_from,type:type,from:from ,change_to:change_to
end
#get cloud domain