fix timezone - time with local timezone to default timezone
This commit is contained in:
@@ -13,7 +13,7 @@ class Api::BillController < Api::ApiController
|
||||
if params[:booking_id].present?
|
||||
booking = Booking.find(params[:booking_id])
|
||||
if booking.booking_orders.count > 0
|
||||
if booking.checkin_at.utc.strftime("%Y-%m-%d %H:%M") > Time.now.utc.strftime("%Y-%m-%d %H:%M") && booking.checkout_at.nil?
|
||||
if booking.checkin_at > Time.current && booking.checkout_at.nil?
|
||||
@status = false
|
||||
@error_message = "Operation failed, Could not request bill!"
|
||||
else
|
||||
|
||||
@@ -40,11 +40,11 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||
|
||||
if !lookup_checkout_time.empty?
|
||||
now = Time.now.utc
|
||||
now = Time.current
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
arr_time = checkout_time[0].split("-")
|
||||
start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p")
|
||||
end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p")
|
||||
start_time = Time.zone.parse(arr_time[0].strip).utc.strftime("%H:%M%p")
|
||||
end_time = Time.zone.parse(arr_time[1].strip).utc.strftime("%H:%M%p")
|
||||
if start_time <= now && now <= end_time
|
||||
alert_time_min = checkout_time[1].to_i
|
||||
end
|
||||
@@ -68,18 +68,18 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
if dining_facility.is_active && dining_facility.status == "available"
|
||||
if dining_facility.current_checkin_booking.nil?
|
||||
if params[:checkin_time].present?
|
||||
checkin_at = Time.parse(params[:checkin_time])
|
||||
checkin_at = Time.zone.parse(params[:checkin_time])
|
||||
else
|
||||
checkin_at = Time.now
|
||||
checkin_at = Time.current
|
||||
end
|
||||
|
||||
checkout_at = nil
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
||||
today = Time.now
|
||||
today = Time.current
|
||||
if !lookup_checkout_time.empty?
|
||||
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
start_time, end_time = checkout_time[0].split("-").map{ |t| Time.parse(t.strip).strftime("%H:%M%p") }
|
||||
start_time, end_time = checkout_time[0].split("-").map{ |t| Time.zone.parse(t.strip).strftime("%H:%M%p") }
|
||||
if start_time <= today.strftime("%H:%M%p") && today.strftime("%H:%M%p") <= end_time
|
||||
checkout_at = checkin_at + (checkout_time[1]).to_i.minutes
|
||||
end
|
||||
@@ -134,7 +134,7 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
|
||||
def request_time
|
||||
if !params[:booking_id].nil? && !params[:time].nil?
|
||||
time = Time.parse(params[:time])
|
||||
time = Time.zone.parse(params[:time])
|
||||
booking = Booking.find(params[:booking_id])
|
||||
|
||||
checkout_at = booking.checkout_at.utc
|
||||
@@ -163,9 +163,9 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
if !params[:booking_id].nil? && !params[:checkout_time].nil?
|
||||
booking = Booking.find(params[:booking_id])
|
||||
dining_facility = DiningFacility.find(booking.dining_facility_id)
|
||||
checkout_at = Time.parse(params[:checkout_time]).utc
|
||||
checkout_at = Time.zone.parse(params[:checkout_time]).utc
|
||||
if dining_facility.check_time(checkout_at, booking, "checkout")
|
||||
checkout_time = checkout_at.getlocal
|
||||
checkout_time = checkout_at
|
||||
booking.checkout_at = checkout_time
|
||||
booking.reserved_at = checkout_time
|
||||
booking.reserved_by = current_login_employee.name
|
||||
|
||||
@@ -198,7 +198,7 @@ class Api::OrdersController < Api::ApiController
|
||||
if booking_id.present?
|
||||
if booking = Booking.find(booking_id)
|
||||
if booking.checkout_at.present?
|
||||
if booking.checkout_at.utc <= Time.now.utc
|
||||
if booking.checkout_at <= Time.current
|
||||
status = false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -31,38 +31,38 @@ class BaseReportController < ActionController::Base
|
||||
period = params[:period]
|
||||
|
||||
if params[:from].present? && params[:to].present?
|
||||
from = Time.parse(params[:from])
|
||||
to = Time.parse(params[:to])
|
||||
from = Time.zone.parse(params[:from])
|
||||
to = Time.zone.parse(params[:to])
|
||||
|
||||
else
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
from = Time.now
|
||||
to = Time.now
|
||||
from = Time.current
|
||||
to = Time.current
|
||||
when PERIOD["yesterday"]
|
||||
from = 1.day.ago
|
||||
to = 1.day.ago
|
||||
when PERIOD["this_week"]
|
||||
from = Time.now.beginning_of_week
|
||||
to = Time.now
|
||||
from = Time.current.beginning_of_week
|
||||
to = Time.current
|
||||
when PERIOD["last_week"]
|
||||
from = 1.week.ago.beginning_of_week
|
||||
to = 1.week.ago.end_of_week
|
||||
when PERIOD["last_7"]
|
||||
from = 7.day.ago
|
||||
to = Time.now
|
||||
to = Time.current
|
||||
when PERIOD["this_month"]
|
||||
from = Time.now.beginning_of_month
|
||||
to = Time.now
|
||||
from = Time.current.beginning_of_month
|
||||
to = Time.current
|
||||
when PERIOD["last_month"]
|
||||
from = 1.month.ago.beginning_of_month
|
||||
to = 1.month.ago.end_of_month
|
||||
when PERIOD["last_30"]
|
||||
from = 30.day.ago
|
||||
to = Time.now
|
||||
to = Time.current
|
||||
when PERIOD["this_year"]
|
||||
from = Time.now.beginning_of_year
|
||||
to = Time.now
|
||||
from = Time.current.beginning_of_year
|
||||
to = Time.current
|
||||
when PERIOD["last_year"]
|
||||
from = 1.year.ago.beginning_of_year
|
||||
to = 1.year.ago.end_of_year
|
||||
|
||||
@@ -105,7 +105,7 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
|
||||
booking = Booking.create({:dining_facility_id => params[:table_id],
|
||||
:type => type,
|
||||
:checkin_at => Time.now.utc,
|
||||
:checkin_at => Time.current,
|
||||
:customer_id => queue.customer_id,
|
||||
:booking_status => "assign"})
|
||||
booking.save!
|
||||
|
||||
@@ -3,8 +3,8 @@ class Crm::HomeController < BaseCrmController
|
||||
|
||||
@booking = Booking.all
|
||||
@customer = Customer.all
|
||||
from = Time.now.beginning_of_day.utc
|
||||
to = Time.now.end_of_day.utc
|
||||
from = Time.current.beginning_of_day
|
||||
to = Time.current.end_of_day
|
||||
@queue = DiningQueue.where('created_at BETWEEN ? AND ?', from, to).order('queue_no ASC')
|
||||
redirect_to crm_customers_path
|
||||
# .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||
|
||||
@@ -78,15 +78,15 @@ private
|
||||
def get_date_range_from_params
|
||||
if params[:from].present? && params[:to].present?
|
||||
if params[:from_time].present? && params[:to_time].present?
|
||||
from = Time.parse("#{params[:from]} #{params[:from_time]}")
|
||||
to = Time.parse("#{params[:to]} #{params[:to_time]}")
|
||||
from = Time.zone.parse("#{params[:from]} #{params[:from_time]}")
|
||||
to = Time.zone.parse("#{params[:to]} #{params[:to_time]}")
|
||||
else
|
||||
from = Time.parse(params[:from])
|
||||
to = Time.parse(params[:to]).end_of_day
|
||||
from = Time.zone.parse(params[:from])
|
||||
to = Time.zone.parse(params[:to]).end_of_day
|
||||
end
|
||||
else
|
||||
from = Time.now.beginning_of_day
|
||||
to = Time.now.end_of_day
|
||||
from = Time.current.beginning_of_day
|
||||
to = Time.current.end_of_day
|
||||
end
|
||||
return from, to
|
||||
end
|
||||
|
||||
@@ -32,7 +32,7 @@ class Induties::AssignInDutiesController < ApplicationController
|
||||
induty.booking_id = booking_id
|
||||
induty.commissioner_ids = commissioner_ids
|
||||
induty.by_name = params[:by_name]
|
||||
induty.in_time = Time.now.utc
|
||||
induty.in_time = Time.current
|
||||
if induty.save
|
||||
dinning = DiningFacility.find(induty.dinning_id)
|
||||
@induty= {"id"=>induty.id,
|
||||
@@ -48,7 +48,7 @@ class Induties::AssignInDutiesController < ApplicationController
|
||||
def induties_checkout
|
||||
induty_id = params[:induty_id]
|
||||
induty = InDuty.find(induty_id)
|
||||
induty.out_time = Time.now.utc
|
||||
induty.out_time = Time.current
|
||||
induty.save
|
||||
@induty =induty
|
||||
respond_to do |format|
|
||||
|
||||
@@ -90,7 +90,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = 0 AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}'")
|
||||
.where("assigned_order_items.delivery_status = 0 AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.current.beginning_of_day.utc}'")
|
||||
.group("assigned_order_items.assigned_order_item_id")
|
||||
.order("assigned_order_items.created_at")
|
||||
end
|
||||
@@ -106,7 +106,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = true AND odt.price <> 0 AND assigned_order_items.created_at between '#{Time.now.beginning_of_day.utc}' and '#{Time.now.end_of_day.utc}'")
|
||||
.where("assigned_order_items.delivery_status = true AND odt.price <> 0 AND assigned_order_items.created_at between '#{Time.current.beginning_of_day.utc}' and '#{Time.current.end_of_day.utc}'")
|
||||
.group("assigned_order_items.order_id")
|
||||
.limit(20)
|
||||
.order("assigned_order_items.created_at")
|
||||
|
||||
@@ -192,7 +192,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' #{oqs} #{table} #{queue_status}")
|
||||
.where("assigned_order_items.created_at >= '#{Time.current.beginning_of_day.utc}' #{oqs} #{table} #{queue_status}")
|
||||
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
.order("assigned_order_items.assigned_order_item_id desc")
|
||||
.group("odt.order_items_id")
|
||||
@@ -210,7 +210,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.delivery_status = true AND assigned_order_items.created_at between '#{Time.now.beginning_of_day.utc}' and '#{Time.now.end_of_day.utc}'")
|
||||
.where("assigned_order_items.delivery_status = true AND assigned_order_items.created_at between '#{Time.current.beginning_of_day.utc}' and '#{Time.current.end_of_day.utc}'")
|
||||
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
.group("assigned_order_items.order_id")
|
||||
.limit(50)
|
||||
@@ -231,7 +231,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("assigned_order_items.created_at between '#{Time.now.beginning_of_day.utc}' and '#{Time.now.end_of_day.utc}'")
|
||||
.where("assigned_order_items.created_at between '#{Time.current.beginning_of_day.utc}' and '#{Time.current.end_of_day.utc}'")
|
||||
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
.group("odt.order_items_id")
|
||||
.order("assigned_order_items.created_at desc")
|
||||
@@ -266,7 +266,7 @@ class Oqs::HomeController < BaseOqsController
|
||||
left join booking_orders as bo on bo.order_id = aoi.order_id
|
||||
left join bookings as bk on bk.booking_id = bo.booking_id
|
||||
left join dining_facilities as df on df.id = bk.dining_facility_id")
|
||||
.where("aoi.delivery_status = #{status} AND aoi.created_at >= '#{Time.now.beginning_of_day.utc}' ")
|
||||
.where("aoi.delivery_status = #{status} AND aoi.created_at >= '#{Time.current.beginning_of_day.utc}' ")
|
||||
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
|
||||
.group("order_queue_stations.id")
|
||||
end
|
||||
|
||||
@@ -3,8 +3,8 @@ class Origami::BankIntegrationController < ApplicationController #BaseOrigamiCon
|
||||
def settle_trans
|
||||
if(params[:type] == 'request')
|
||||
card_settle_trans = CardSettleTran.new()
|
||||
card_settle_trans.req_date = Time.now.strftime("%Y-%m-%d")
|
||||
card_settle_trans.req_time = Time.now.utc
|
||||
card_settle_trans.req_date = Time.current.strftime("%Y-%m-%d")
|
||||
card_settle_trans.req_time = Time.current
|
||||
card_settle_trans.req_cmd = params[:data][:cmd_type]
|
||||
card_settle_trans.req_type = params[:data][:payment_type]
|
||||
card_settle_trans.save()
|
||||
@@ -13,8 +13,8 @@ class Origami::BankIntegrationController < ApplicationController #BaseOrigamiCon
|
||||
response = {status: 'success', card_settle_trans_id: card_settle_trans_id}
|
||||
else
|
||||
card_settle_trans = CardSettleTran.find(params[:card_settle_trans_id])
|
||||
card_settle_trans.res_date = Time.now.strftime("%Y-%m-%d")
|
||||
card_settle_trans.res_time = Time.now.utc
|
||||
card_settle_trans.res_date = Time.current.strftime("%Y-%m-%d")
|
||||
card_settle_trans.res_time = Time.current
|
||||
card_settle_trans.res_cmd = params[:data][:CMD]
|
||||
card_settle_trans.res_type = params[:data][:TYPE]
|
||||
card_settle_trans.status = params[:data][:STATUS]
|
||||
@@ -42,8 +42,8 @@ class Origami::BankIntegrationController < ApplicationController #BaseOrigamiCon
|
||||
if(params[:type] == 'request')
|
||||
card_sale_trans = CardSaleTran.new()
|
||||
card_sale_trans.sale_id = params[:data][:sale_id]
|
||||
card_sale_trans.req_date = Time.now.strftime("%Y-%m-%d")
|
||||
card_sale_trans.req_time = Time.now.utc
|
||||
card_sale_trans.req_date = Time.current.strftime("%Y-%m-%d")
|
||||
card_sale_trans.req_time = Time.current
|
||||
card_sale_trans.req_amt = params[:data][:amt]
|
||||
card_sale_trans.req_inv_no = params[:data][:inv_no]
|
||||
card_sale_trans.req_cmd = params[:data][:cmd_type]
|
||||
|
||||
@@ -2,14 +2,14 @@ class Origami::CheckInProcessController < BaseOrigamiController
|
||||
|
||||
def check_in_process
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_time")
|
||||
today = Time.now
|
||||
checkout_at = Time.now
|
||||
today = Time.current
|
||||
checkout_at = Time.current
|
||||
|
||||
if !lookup_checkout_time.empty?
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
arr_time = checkout_time[0].split("-")
|
||||
start_time = Time.parse(arr_time[0].strip).strftime("%H:%M%p")
|
||||
end_time = Time.parse(arr_time[1].strip).strftime("%H:%M%p")
|
||||
start_time = Time.zone.parse(arr_time[0].strip).strftime("%H:%M%p")
|
||||
end_time = Time.zone.parse(arr_time[1].strip).strftime("%H:%M%p")
|
||||
if start_time <= checkout_at.strftime("%H:%M%p") && checkout_at.strftime("%H:%M%p") <= end_time
|
||||
checkout_at = checkout_at + (checkout_time[1]).to_i.minutes
|
||||
end
|
||||
@@ -25,7 +25,7 @@ class Origami::CheckInProcessController < BaseOrigamiController
|
||||
# end
|
||||
|
||||
@booking = Booking.create({:dining_facility_id => params[:dining_id],:type => "TableBooking",
|
||||
:checkin_by=>current_login_employee.name,:checkin_at => Time.now.utc,:checkout_at =>checkout_at, :booking_status => "assign", :reserved_at => checkout_at, :reserved_by => current_login_employee.name })
|
||||
:checkin_by=>current_login_employee.name,:checkin_at => Time.current,:checkout_at =>checkout_at, :booking_status => "assign", :reserved_at => checkout_at, :reserved_by => current_login_employee.name })
|
||||
|
||||
cashier_terminal = CashierTerminal.find_by_id(@dining_facility.zone_id)
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class Origami::FoodCourtController < ApplicationController
|
||||
|
||||
def index
|
||||
today = DateTime.now
|
||||
day = Date.today.wday
|
||||
day = Date.current.wday
|
||||
# if params[:menu] == "true"
|
||||
@menus = []
|
||||
@menu = []
|
||||
@@ -48,7 +48,7 @@ class Origami::FoodCourtController < ApplicationController
|
||||
def modify_order
|
||||
@cashier_type = "food_court"
|
||||
today = DateTime.now
|
||||
day = Date.today.wday
|
||||
day = Date.current.wday
|
||||
# if params[:menu] == "true"
|
||||
@menus = []
|
||||
@menu = []
|
||||
|
||||
@@ -14,7 +14,7 @@ class Origami::MoveroomController < BaseOrigamiController
|
||||
@status_sale = ""
|
||||
@sale_array = Array.new
|
||||
@dining = DiningFacility.find(params[:dining_id])
|
||||
@dining_room = @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.today.prev_day}' ")
|
||||
@dining_room = @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_room.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
@order_items = Array.new
|
||||
|
||||
@@ -15,7 +15,7 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
@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.today.prev_day}' ")
|
||||
@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.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
@@ -73,7 +73,7 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
|
||||
# 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.today.prev_day}')) AND 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}'")
|
||||
|
||||
booking_array = Array.new
|
||||
order_items = Array.new
|
||||
|
||||
@@ -9,7 +9,7 @@ class Origami::QuickServiceController < ApplicationController
|
||||
|
||||
def index
|
||||
today = DateTime.now
|
||||
day = Date.today.wday
|
||||
day = Date.current.wday
|
||||
|
||||
@menus = []
|
||||
@menu = []
|
||||
@@ -47,7 +47,7 @@ class Origami::QuickServiceController < ApplicationController
|
||||
def modify_order
|
||||
@cashier_type = "quick_service"
|
||||
today = DateTime.now
|
||||
day = Date.today.wday
|
||||
day = Date.current.wday
|
||||
# if params[:menu] == "true"
|
||||
@menus = []
|
||||
@menu = []
|
||||
|
||||
@@ -12,7 +12,7 @@ class Origami::RequestBillsController < ApplicationController
|
||||
order_id = params[:id] # order_id
|
||||
order = Order.find(order_id)
|
||||
booking = order.booking
|
||||
if booking.checkin_at.utc > Time.now.utc && booking.checkout_at.nil?
|
||||
if booking.checkin_at > Time.current && booking.checkout_at.nil?
|
||||
@status = false
|
||||
@error_message = "Operation failed, Could not request bill!"
|
||||
else
|
||||
@@ -26,7 +26,7 @@ class Origami::RequestBillsController < ApplicationController
|
||||
in_duties.each do |in_duty|
|
||||
induty = InDuty.find(in_duty.id)
|
||||
induty.sale_id = sale_data.sale_id
|
||||
induty.out_time = Time.now.utc
|
||||
induty.out_time = Time.current
|
||||
induty.save
|
||||
end
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
@membership = MembershipSetting::MembershipSetting
|
||||
@payment_methods = PaymentMethodSetting.all
|
||||
|
||||
@dining_room = @room.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.today.prev_day}' ")
|
||||
@dining_room = @room.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}' ")
|
||||
@order_items = Array.new
|
||||
@dining_room.each do |booking|
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
|
||||
@@ -62,7 +62,7 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
split_orders = []
|
||||
new_order = nil
|
||||
|
||||
booking = Booking.create({:dining_facility_id => table.id, :type => type, :checkin_at => Time.now.utc, :checkin_by => current_user.name, :booking_status => "assign" })
|
||||
booking = Booking.create({:dining_facility_id => table.id, :type => type, :checkin_at => Time.current, :checkin_by => current_user.name, :booking_status => "assign" })
|
||||
|
||||
if orders.present?
|
||||
split_orders += orders.map { |x| x["id"] }
|
||||
|
||||
@@ -30,9 +30,9 @@ class Settings::DiningChargesController < ApplicationController
|
||||
def create
|
||||
@dining_charge = DiningCharge.new(dining_charge_params)
|
||||
@dining_charge.dining_facility_id = @settings_dining_facility.id
|
||||
@dining_charge.minimum_free_time = DateTime.parse(dining_charge_params["minimum_free_time"])
|
||||
@dining_charge.charge_block = DateTime.parse(dining_charge_params["charge_block"])
|
||||
@dining_charge.time_rounding_block = DateTime.parse(dining_charge_params["time_rounding_block"])
|
||||
@dining_charge.minimum_free_time = Time.zone.parse(dining_charge_params["minimum_free_time"])
|
||||
@dining_charge.charge_block = Time.zone.parse(dining_charge_params["charge_block"])
|
||||
@dining_charge.time_rounding_block = Time.zone.parse(dining_charge_params["time_rounding_block"])
|
||||
|
||||
respond_to do |format|
|
||||
if @dining_charge.save
|
||||
@@ -54,14 +54,14 @@ class Settings::DiningChargesController < ApplicationController
|
||||
def update
|
||||
respond_to do |format|
|
||||
@dining_charge.dining_facility_id = @settings_dining_facility.id
|
||||
@dining_charge.minimum_free_time = DateTime.parse(dining_charge_params["minimum_free_time"])
|
||||
@dining_charge.charge_block = DateTime.parse(dining_charge_params["charge_block"])
|
||||
@dining_charge.time_rounding_block = DateTime.parse(dining_charge_params["time_rounding_block"])
|
||||
@dining_charge.minimum_free_time = Time.zone.parse(dining_charge_params["minimum_free_time"])
|
||||
@dining_charge.charge_block = Time.zone.parse(dining_charge_params["charge_block"])
|
||||
@dining_charge.time_rounding_block = Time.zone.parse(dining_charge_params["time_rounding_block"])
|
||||
|
||||
if @dining_charge.update(dining_charge_params)
|
||||
@dining_charge.minimum_free_time = DateTime.parse(dining_charge_params["minimum_free_time"])
|
||||
@dining_charge.charge_block = DateTime.parse(dining_charge_params["charge_block"])
|
||||
@dining_charge.time_rounding_block = DateTime.parse(dining_charge_params["time_rounding_block"])
|
||||
@dining_charge.minimum_free_time = Time.zone.parse(dining_charge_params["minimum_free_time"])
|
||||
@dining_charge.charge_block = Time.zone.parse(dining_charge_params["charge_block"])
|
||||
@dining_charge.time_rounding_block = Time.zone.parse(dining_charge_params["time_rounding_block"])
|
||||
# @dining_charge.minimum_free_time = @dining_charge.minimum_free_time.to_datetime.advance(hours: +6, minutes: +30)
|
||||
# @dining_charge.charge_block = @dining_charge.charge_block.to_datetime.advance(hours: +6, minutes: +30)
|
||||
# @dining_charge.time_rounding_block = @dining_charge.time_rounding_block.to_datetime.advance(hours: +6, minutes: +30)
|
||||
|
||||
@@ -12,6 +12,8 @@ class Transactions::BookingsController < ApplicationController
|
||||
@bookings = Booking.order("sale_id desc")
|
||||
@bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(20)
|
||||
else
|
||||
from = Time.zone.parse(params[:from]).beginning_of_day
|
||||
to = Time.zone.parse(params[:to]).end_of_day
|
||||
booking = Booking.search(filter,from,to)
|
||||
if booking.count > 0
|
||||
@bookings = booking
|
||||
|
||||
@@ -50,54 +50,49 @@ class Transactions::CardSaleTransController < ApplicationController
|
||||
def get_date_range_from_params
|
||||
period_type = params[:period_type]
|
||||
period = params[:period]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
day_ref = Time.now
|
||||
if from.present? && to.present?
|
||||
f_date = DateTime.parse(from)
|
||||
t_date = DateTime.parse(to)
|
||||
f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||
t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||
from = f_time.beginning_of_day
|
||||
to = t_time.end_of_day
|
||||
else
|
||||
|
||||
if params[:from].present? && params[:to].present?
|
||||
from = Time.zone.parse(params[:from])
|
||||
to = Time.zone.parse(params[:to])
|
||||
else
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
from = day_ref.beginning_of_day.utc
|
||||
to = day_ref.end_of_day.utc
|
||||
|
||||
from = Time.current
|
||||
to = Time.current
|
||||
when PERIOD["yesterday"]
|
||||
from = (day_ref - 1.day).beginning_of_day.utc
|
||||
to = (day_ref - 1.day).end_of_day.utc
|
||||
|
||||
from = 1.day.ago
|
||||
to = 1.day.ago
|
||||
when PERIOD["this_week"]
|
||||
from = Time.now.beginning_of_week.utc
|
||||
to = Time.now.utc
|
||||
from = Time.current.beginning_of_week
|
||||
to = Time.current
|
||||
when PERIOD["last_week"]
|
||||
from = (day_ref - 7.day).beginning_of_week.utc
|
||||
to = (day_ref - 7.day).end_of_week.utc
|
||||
from = 1.week.ago.beginning_of_week
|
||||
to = 1.week.ago.end_of_week
|
||||
when PERIOD["last_7"]
|
||||
from = (day_ref - 7.day).utc
|
||||
to = Time.now.utc
|
||||
from = 7.day.ago
|
||||
to = Time.current
|
||||
when PERIOD["this_month"]
|
||||
from = Time.now.beginning_of_month.utc
|
||||
to = Time.now.utc
|
||||
from = Time.current.beginning_of_month
|
||||
to = Time.current
|
||||
when PERIOD["last_month"]
|
||||
from = (day_ref - 1.month).beginning_of_month.utc
|
||||
to = (day_ref - 1.month).end_of_month.utc
|
||||
from = 1.month.ago.beginning_of_month
|
||||
to = 1.month.ago.end_of_month
|
||||
when PERIOD["last_30"]
|
||||
from = (day_ref - 30.day).utc
|
||||
to = Time.now.utc
|
||||
from = 30.day.ago
|
||||
to = Time.current
|
||||
when PERIOD["this_year"]
|
||||
from = Time.now.beginning_of_year.utc
|
||||
to = Time.now.utc
|
||||
from = Time.current.beginning_of_year
|
||||
to = Time.current
|
||||
when PERIOD["last_year"]
|
||||
from = (day_ref - 1.year).beginning_of_year.utc
|
||||
to = (day_ref - 1.year).end_of_year.utc
|
||||
end
|
||||
from = 1.year.ago.beginning_of_year
|
||||
to = 1.year.ago.end_of_year
|
||||
end
|
||||
end
|
||||
|
||||
return from, to
|
||||
from = from.beginning_of_day
|
||||
to = to.end_of_day
|
||||
|
||||
return from, to
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -51,54 +51,49 @@ class Transactions::CardSettleTransController < ApplicationController
|
||||
def get_date_range_from_params
|
||||
period_type = params[:period_type]
|
||||
period = params[:period]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
day_ref = Time.now
|
||||
if from.present? && to.present?
|
||||
f_date = DateTime.parse(from)
|
||||
t_date = DateTime.parse(to)
|
||||
f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||
t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||
from = f_time.beginning_of_day
|
||||
to = t_time.end_of_day
|
||||
else
|
||||
|
||||
if params[:from].present? && params[:to].present?
|
||||
from = Time.zone.parse(params[:from])
|
||||
to = Time.zone.parse(params[:to])
|
||||
else
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
from = day_ref.beginning_of_day.utc
|
||||
to = day_ref.end_of_day.utc
|
||||
|
||||
from = Time.current
|
||||
to = Time.current
|
||||
when PERIOD["yesterday"]
|
||||
from = (day_ref - 1.day).beginning_of_day.utc
|
||||
to = (day_ref - 1.day).end_of_day.utc
|
||||
|
||||
from = 1.day.ago
|
||||
to = 1.day.ago
|
||||
when PERIOD["this_week"]
|
||||
from = Time.now.beginning_of_week.utc
|
||||
to = Time.now.utc
|
||||
from = Time.current.beginning_of_week
|
||||
to = Time.current
|
||||
when PERIOD["last_week"]
|
||||
from = (day_ref - 7.day).beginning_of_week.utc
|
||||
to = (day_ref - 7.day).end_of_week.utc
|
||||
from = 1.week.ago.beginning_of_week
|
||||
to = 1.week.ago.end_of_week
|
||||
when PERIOD["last_7"]
|
||||
from = (day_ref - 7.day).utc
|
||||
to = Time.now.utc
|
||||
from = 7.day.ago
|
||||
to = Time.current
|
||||
when PERIOD["this_month"]
|
||||
from = Time.now.beginning_of_month.utc
|
||||
to = Time.now.utc
|
||||
from = Time.current.beginning_of_month
|
||||
to = Time.current
|
||||
when PERIOD["last_month"]
|
||||
from = (day_ref - 1.month).beginning_of_month.utc
|
||||
to = (day_ref - 1.month).end_of_month.utc
|
||||
from = 1.month.ago.beginning_of_month
|
||||
to = 1.month.ago.end_of_month
|
||||
when PERIOD["last_30"]
|
||||
from = (day_ref - 30.day).utc
|
||||
to = Time.now.utc
|
||||
from = 30.day.ago
|
||||
to = Time.current
|
||||
when PERIOD["this_year"]
|
||||
from = Time.now.beginning_of_year.utc
|
||||
to = Time.now.utc
|
||||
from = Time.current.beginning_of_year
|
||||
to = Time.current
|
||||
when PERIOD["last_year"]
|
||||
from = (day_ref - 1.year).beginning_of_year.utc
|
||||
to = (day_ref - 1.year).end_of_year.utc
|
||||
end
|
||||
from = 1.year.ago.beginning_of_year
|
||||
to = 1.year.ago.end_of_year
|
||||
end
|
||||
end
|
||||
|
||||
return from, to
|
||||
from = from.beginning_of_day
|
||||
to = to.end_of_day
|
||||
|
||||
return from, to
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -12,10 +12,13 @@ class Transactions::CreditNotesController < ApplicationController
|
||||
|
||||
filter = params[:filter]
|
||||
customer = params[:customer]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
order_source = params[:order_source]
|
||||
|
||||
if params[:from].present? && params[:to].present?
|
||||
from = Time.zone.parse(params[:from]).beginning_of_day
|
||||
to = Time.zone.parse(params[:to]).end_of_day
|
||||
end
|
||||
|
||||
if filter.nil? && from.nil? && to.nil? && customer.nil? && order_source.nil?
|
||||
order_source_query = "(select orders.source FROM orders JOIN sale_orders so ON so.order_id=orders.order_id WHERE so.sale_id=sales.sale_id GROUP BY so.sale_id)"
|
||||
|
||||
|
||||
@@ -73,54 +73,48 @@ class Transactions::OrderReservationsController < ApplicationController
|
||||
def get_date_range_from_params
|
||||
period_type = params[:period_type]
|
||||
period = params[:period]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
day_ref = Time.now
|
||||
|
||||
if from.present? && to.present?
|
||||
f_date = DateTime.parse(from)
|
||||
t_date = DateTime.parse(to)
|
||||
f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||
t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||
from = f_time.beginning_of_day
|
||||
to = t_time.end_of_day
|
||||
if params[:from].present? && params[:to].present?
|
||||
from = Time.zone.parse(params[:from])
|
||||
to = Time.zone.parse(params[:to])
|
||||
else
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
from = day_ref.beginning_of_day.utc
|
||||
to = day_ref.end_of_day.utc
|
||||
|
||||
from = Time.current
|
||||
to = Time.current
|
||||
when PERIOD["yesterday"]
|
||||
from = (day_ref - 1.day).beginning_of_day.utc
|
||||
to = (day_ref - 1.day).end_of_day.utc
|
||||
|
||||
from = 1.day.ago
|
||||
to = 1.day.ago
|
||||
when PERIOD["this_week"]
|
||||
from = Time.now.beginning_of_week.utc
|
||||
to = Time.now.utc
|
||||
from = Time.current.beginning_of_week
|
||||
to = Time.current
|
||||
when PERIOD["last_week"]
|
||||
from = (day_ref - 7.day).beginning_of_week.utc
|
||||
to = (day_ref - 7.day).end_of_week.utc
|
||||
from = 1.week.ago.beginning_of_week
|
||||
to = 1.week.ago.end_of_week
|
||||
when PERIOD["last_7"]
|
||||
from = (day_ref - 7.day).utc
|
||||
to = Time.now.utc
|
||||
from = 7.day.ago
|
||||
to = Time.current
|
||||
when PERIOD["this_month"]
|
||||
from = Time.now.beginning_of_month.utc
|
||||
to = Time.now.utc
|
||||
from = Time.current.beginning_of_month
|
||||
to = Time.current
|
||||
when PERIOD["last_month"]
|
||||
from = (day_ref - 1.month).beginning_of_month.utc
|
||||
to = (day_ref - 1.month).end_of_month.utc
|
||||
from = 1.month.ago.beginning_of_month
|
||||
to = 1.month.ago.end_of_month
|
||||
when PERIOD["last_30"]
|
||||
from = (day_ref - 30.day).utc
|
||||
to = Time.now.utc
|
||||
from = 30.day.ago
|
||||
to = Time.current
|
||||
when PERIOD["this_year"]
|
||||
from = Time.now.beginning_of_year.utc
|
||||
to = Time.now.utc
|
||||
from = Time.current.beginning_of_year
|
||||
to = Time.current
|
||||
when PERIOD["last_year"]
|
||||
from = (day_ref - 1.year).beginning_of_year.utc
|
||||
to = (day_ref - 1.year).end_of_year.utc
|
||||
from = 1.year.ago.beginning_of_year
|
||||
to = 1.year.ago.end_of_year
|
||||
end
|
||||
end
|
||||
|
||||
from = from.beginning_of_day
|
||||
to = to.end_of_day
|
||||
|
||||
return from, to
|
||||
end
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ class Transactions::OrdersController < ApplicationController
|
||||
if filter.nil? && from.nil? && to.nil?
|
||||
orders = Order.order("order_id desc")
|
||||
else
|
||||
from = Time.zone.parse(params[:from]).beginning_of_day
|
||||
to = Time.zone.parse(params[:to]).end_of_day
|
||||
orders = Order.search(filter,from,to)
|
||||
end
|
||||
|
||||
|
||||
@@ -181,53 +181,47 @@ class Transactions::SalesController < ApplicationController
|
||||
def get_date_range_from_params
|
||||
period_type = params[:period_type]
|
||||
period = params[:period]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
day_ref = Time.now
|
||||
|
||||
if from.present? && to.present?
|
||||
f_date = DateTime.parse(from)
|
||||
t_date = DateTime.parse(to)
|
||||
f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec)
|
||||
t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec)
|
||||
from = f_time.beginning_of_day
|
||||
to = t_time.end_of_day
|
||||
else
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
from = day_ref.beginning_of_day.utc
|
||||
to = day_ref.end_of_day.utc
|
||||
if params[:from].present? && params[:to].present?
|
||||
from = Time.zone.parse(params[:from])
|
||||
to = Time.zone.parse(params[:to])
|
||||
else
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
from = Time.current
|
||||
to = Time.current
|
||||
when PERIOD["yesterday"]
|
||||
from = 1.day.ago
|
||||
to = 1.day.ago
|
||||
when PERIOD["this_week"]
|
||||
from = Time.current.beginning_of_week
|
||||
to = Time.current
|
||||
when PERIOD["last_week"]
|
||||
from = 1.week.ago.beginning_of_week
|
||||
to = 1.week.ago.end_of_week
|
||||
when PERIOD["last_7"]
|
||||
from = 7.day.ago
|
||||
to = Time.current
|
||||
when PERIOD["this_month"]
|
||||
from = Time.current.beginning_of_month
|
||||
to = Time.current
|
||||
when PERIOD["last_month"]
|
||||
from = 1.month.ago.beginning_of_month
|
||||
to = 1.month.ago.end_of_month
|
||||
when PERIOD["last_30"]
|
||||
from = 30.day.ago
|
||||
to = Time.current
|
||||
when PERIOD["this_year"]
|
||||
from = Time.current.beginning_of_year
|
||||
to = Time.current
|
||||
when PERIOD["last_year"]
|
||||
from = 1.year.ago.beginning_of_year
|
||||
to = 1.year.ago.end_of_year
|
||||
end
|
||||
end
|
||||
|
||||
when PERIOD["yesterday"]
|
||||
from = (day_ref - 1.day).beginning_of_day.utc
|
||||
to = (day_ref - 1.day).end_of_day.utc
|
||||
|
||||
when PERIOD["this_week"]
|
||||
from = Time.now.beginning_of_week.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_week"]
|
||||
from = (day_ref - 7.day).beginning_of_week.utc
|
||||
to = (day_ref - 7.day).end_of_week.utc
|
||||
when PERIOD["last_7"]
|
||||
from = (day_ref - 7.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_month"]
|
||||
from = Time.now.beginning_of_month.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_month"]
|
||||
from = (day_ref - 1.month).beginning_of_month.utc
|
||||
to = (day_ref - 1.month).end_of_month.utc
|
||||
when PERIOD["last_30"]
|
||||
from = (day_ref - 30.day).utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["this_year"]
|
||||
from = Time.now.beginning_of_year.utc
|
||||
to = Time.now.utc
|
||||
when PERIOD["last_year"]
|
||||
from = (day_ref - 1.year).beginning_of_year.utc
|
||||
to = (day_ref - 1.year).end_of_year.utc
|
||||
end
|
||||
end
|
||||
from = from.beginning_of_day
|
||||
to = to.end_of_day
|
||||
|
||||
return from, to
|
||||
end
|
||||
|
||||
@@ -13,6 +13,8 @@ class Transactions::ShiftSalesController < ApplicationController
|
||||
@shift_sales = ShiftSale.all.order("id desc")
|
||||
@shift_sales = Kaminari.paginate_array(@shift_sales).page(params[:page]).per(20)
|
||||
else
|
||||
from = Time.zone.parse(from).beginning_of_day
|
||||
to = Time.zone.parse(to).end_of_day
|
||||
shift_sale = ShiftSale.search(filter,from,to)
|
||||
if shift_sale.count > 0
|
||||
@shift_sales = shift_sale
|
||||
|
||||
@@ -8,6 +8,8 @@ class Transactions::SurveysController < ApplicationController
|
||||
if filter.nil? && from.nil? && to.nil?
|
||||
@surveys = Survey.all
|
||||
else
|
||||
from = Time.zone.parse(params[:from]).beginning_of_day
|
||||
to = Time.zone.parse(params[:to]).end_of_day
|
||||
@surveys = Survey.search(filter,from,to)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user