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
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class AssignedOrderItem < ApplicationRecord
|
||||
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.order_id = '#{order_id}' AND assigned_order_items.delivery_status = false AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' ")
|
||||
.where("assigned_order_items.order_id = '#{order_id}' AND assigned_order_items.delivery_status = false AND assigned_order_items.created_at >= '#{Time.current.beginning_of_day.utc}' ")
|
||||
.order("assigned_order_items.assigned_order_item_id desc")
|
||||
.group("assigned_order_items.assigned_order_item_id")
|
||||
return order_item
|
||||
|
||||
@@ -60,7 +60,7 @@ class Booking < ApplicationRecord
|
||||
end
|
||||
|
||||
scope :active, -> { where('booking_status != ?', 'moved') }
|
||||
scope :today, -> { where('created_at >= ?', Time.now) }
|
||||
scope :today, -> { where('created_at >= ?', Time.current) }
|
||||
scope :assign, -> { where(booking_status: 'assign') }
|
||||
|
||||
def self.sync_booking_records(bookings)
|
||||
@@ -128,9 +128,9 @@ class Booking < ApplicationRecord
|
||||
end
|
||||
|
||||
if from.present? && to.present?
|
||||
booking = Booking.joins(" LEFT JOIN dining_facilities df ON df.id=bookings.dining_facility_id")
|
||||
.where("DATE_FORMAT(bookings.created_at,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(bookings.created_at,'%d-%m-%Y') <= ? and NOT bookings.booking_status = 'void' ", from,to)
|
||||
query = booking.where(keyword)
|
||||
booking = Booking.joins(" LEFT JOIN dining_facilities df ON df.id=bookings.dining_facility_id")
|
||||
.where("bookings.created_at BETWEEN ? AND ? and NOT bookings.booking_status = 'void' ", from,to)
|
||||
query = booking.where(keyword)
|
||||
else
|
||||
joins(" LEFT JOIN dining_facilities df ON df.id=bookings.dining_facility_id")
|
||||
.where("booking_id LIKE ? OR checkin_by LIKE ? OR booking_status LIKE? OR checkout_by LIKE? OR sale_id ='#{filter}' OR df.name LIKE ?","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%")
|
||||
|
||||
@@ -54,22 +54,22 @@ class DiningFacility < ApplicationRecord
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||
free_time_min = 0
|
||||
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).strftime("%H:%M%p")
|
||||
end_time = Time.zone.parse(arr_time[1].strip).strftime("%H:%M%p")
|
||||
if start_time <= now && now <= end_time
|
||||
free_time_min = checkout_time[1].to_i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
now = Time.now.utc
|
||||
now = Time.current
|
||||
hr = (now.strftime("%H").to_i).to_int
|
||||
min = (now.strftime("%M").to_i).to_int
|
||||
if !booking.checkout_at.nil?
|
||||
checkout_at = booking.checkout_at.utc
|
||||
checkout_at = booking.checkout_at
|
||||
checkout_at_hr = (checkout_at.strftime("%H").to_i).to_int
|
||||
checkout_at_min = (checkout_at.strftime("%M").to_i).to_int
|
||||
checkout_at_min -= min
|
||||
@@ -93,11 +93,11 @@ class DiningFacility < ApplicationRecord
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||
free_time_min = 0
|
||||
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
|
||||
free_time_min = checkout_time[1].to_i
|
||||
end
|
||||
@@ -105,11 +105,11 @@ class DiningFacility < ApplicationRecord
|
||||
end
|
||||
|
||||
bookings.each do |booking|
|
||||
now = Time.now.utc
|
||||
now = Time.current
|
||||
hr = (now.strftime("%H").to_i).to_int
|
||||
min = (now.strftime("%M").to_i).to_int
|
||||
if !booking.checkout_at.nil?
|
||||
checkout_at = booking.checkout_at.utc
|
||||
checkout_at = booking.checkout_at
|
||||
checkout_at_hr = (checkout_at.strftime("%H").to_i).to_int
|
||||
checkout_at_min = (checkout_at.strftime("%M").to_i).to_int
|
||||
checkout_at_min -= min
|
||||
@@ -155,8 +155,8 @@ class DiningFacility < ApplicationRecord
|
||||
|
||||
def check_time(time, booking = nil, type)
|
||||
status = true
|
||||
today = Time.now.utc.strftime("%Y-%m-%d %H:%M")
|
||||
check_time = time.strftime("%Y-%m-%d %H:%M")
|
||||
today = Time.current.utc.strftime("%Y-%m-%d %H:%M")
|
||||
check_time = time.utc.strftime("%Y-%m-%d %H:%M")
|
||||
if type.downcase == "checkin"
|
||||
if check_time < today
|
||||
status = false
|
||||
|
||||
@@ -182,33 +182,33 @@ class License
|
||||
|
||||
def expired?
|
||||
if renewal_date_str = read_license("renewable_date")
|
||||
renewal_date = DateTime.parse(renewal_date_str)
|
||||
renewal_date < Date.today
|
||||
renewal_date = Time.zone.parse(renewal_date_str)
|
||||
renewal_date < Date.current
|
||||
end
|
||||
end
|
||||
|
||||
def expire_in?(days)
|
||||
if renewal_date_str = read_license("renewable_date")
|
||||
renewal_date = DateTime.parse(renewal_date_str)
|
||||
renewal_date = Time.zone.parse(renewal_date_str)
|
||||
renewal_date < days.days.from_now
|
||||
end
|
||||
end
|
||||
|
||||
def days_to_expire
|
||||
if renewal_date_str = read_license("renewable_date")
|
||||
Date.today - DateTime.parse(renewal_date_str).to_date
|
||||
Date.current - Time.zone.parse(renewal_date_str).to_date
|
||||
end
|
||||
end
|
||||
|
||||
# Check License expired date from PROVISION SERVER
|
||||
def check_expired(renewal_date_str)
|
||||
expired_date_str = read_license("renewable_date")
|
||||
renewal_date = DateTime.parse(renewal_date_str)
|
||||
renewal_date = Time.zone.parse(renewal_date_str)
|
||||
if(renewal_date_str != expired_date_str)
|
||||
update_license("renewable_date", renewal_date_str)
|
||||
end
|
||||
|
||||
if (renewal_date < Date.today)
|
||||
if (renewal_date < Date.current)
|
||||
return true
|
||||
else
|
||||
return false
|
||||
|
||||
@@ -40,9 +40,9 @@ class MenuCategory < ApplicationRecord
|
||||
def valid_time
|
||||
menu = self.menu
|
||||
|
||||
from_t = Time.parse(menu.valid_time_from.strftime("%H:%M:%S"))
|
||||
to_t = Time.parse(menu.valid_time_to.strftime("%H:%M:%S"))
|
||||
current_t = Time.parse(Time.now.strftime("%H:%M:%S"))
|
||||
from_t = Time.zone.parse(menu.valid_time_from.strftime("%H:%M:%S"))
|
||||
to_t = Time.zone.parse(menu.valid_time_to.strftime("%H:%M:%S"))
|
||||
current_t = Time.zone.parse(Time.current.strftime("%H:%M:%S"))
|
||||
|
||||
from = from_t.hour * 3600 + from_t.min*60 + from_t.sec
|
||||
to = to_t.hour * 3600 + to_t.min* 60 + to_t.sec
|
||||
@@ -73,7 +73,7 @@ class MenuCategory < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
day = Date.today.wday
|
||||
day = Date.current.wday
|
||||
dayresult = menu.valid_days.include?(day.to_s)
|
||||
|
||||
|
||||
|
||||
@@ -29,12 +29,12 @@ class Order < ApplicationRecord
|
||||
#add extra time
|
||||
if self.is_extra_time && self.extra_time
|
||||
booking = Booking.create({:dining_facility_id => table_id,:type => "TableBooking",
|
||||
:checkin_at => Time.now.utc, :checkout_at => Time.now.utc + self.extra_time.to_i,
|
||||
:checkin_at => Time.current, :checkout_at => Time.current + self.extra_time.to_i,
|
||||
:checkin_by => self.employee_name,
|
||||
:booking_status => "assign" })
|
||||
else
|
||||
booking = Booking.create({:dining_facility_id => table_id,:type => "TableBooking",
|
||||
:checkin_at => Time.now.utc, :checkin_by => self.employee_name,
|
||||
:checkin_at => Time.current, :checkin_by => self.employee_name,
|
||||
:booking_status => "assign" })
|
||||
end
|
||||
#end extra time
|
||||
@@ -84,7 +84,7 @@ class Order < ApplicationRecord
|
||||
|
||||
if self.new_booking
|
||||
booking = Booking.create({:dining_facility_id => self.table_id,:type => "TableBooking",
|
||||
:checkin_at => Time.now.utc, :checkin_by => self.employee_name,
|
||||
:checkin_at => Time.current, :checkin_by => self.employee_name,
|
||||
:booking_status => "assign" })
|
||||
table = DiningFacility.find(self.table_id)
|
||||
table.status = "occupied"
|
||||
@@ -316,8 +316,8 @@ class Order < ApplicationRecord
|
||||
|
||||
#Origami: Cashier : to view orders
|
||||
def self.get_orders
|
||||
from = Time.now.beginning_of_day.utc
|
||||
to = Time.now.end_of_day.utc
|
||||
from = Time.current.beginning_of_day.utc
|
||||
to = Time.current.end_of_day.utc
|
||||
orders=Booking.select("sales.receipt_no, sales.sale_status as sale_status, orders.status as order_status,
|
||||
orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id,
|
||||
bookings.booking_id,orders.customer_id as customer_id,
|
||||
@@ -353,7 +353,7 @@ class Order < ApplicationRecord
|
||||
end
|
||||
|
||||
if from.present? && to.present?
|
||||
order = Order.where("DATE_FORMAT(date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(date,'%d-%m-%Y') <= ?", from,to)
|
||||
order = Order.where("date BETWEEN ? AND ?", from, to)
|
||||
query = order.where(keyword)
|
||||
else
|
||||
where("order_id LIKE ? OR status LIKE ? OR order_type LIKE ? OR source='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%")
|
||||
@@ -449,7 +449,7 @@ class Order < ApplicationRecord
|
||||
end
|
||||
|
||||
def set_order_date
|
||||
self.date = Time.now.utc
|
||||
self.date = Time.current
|
||||
end
|
||||
|
||||
def self.sync_order_records(orders)
|
||||
|
||||
@@ -32,7 +32,7 @@ class OrderReservation < ApplicationRecord
|
||||
customer.contact_no = params[:contact_no] ? params[:contact_no] : ''
|
||||
customer.gender = gender
|
||||
customer.address = params[:address] ? params[:address] : ''
|
||||
customer.date_of_birth = params[:date_of_birth] ? Time.parse(params[:date_of_birth]).strftime("%Y-%m-%d") : ''
|
||||
customer.date_of_birth = params[:date_of_birth] ? Time.zone.parse(params[:date_of_birth]).strftime("%Y-%m-%d") : ''
|
||||
customer.membership_id = params[:membership_id]
|
||||
customer.customer_type = "Doemal"
|
||||
customer.tax_profiles = ["2"]
|
||||
@@ -426,7 +426,7 @@ class OrderReservation < ApplicationRecord
|
||||
else
|
||||
shop_code = ''
|
||||
end
|
||||
order_reservation = OrderReservation.where("status='accepted' and requested_time <= '#{Time.now.utc}'")
|
||||
order_reservation = OrderReservation.where("status='accepted' and requested_time <= '#{Time.current.utc}'")
|
||||
if order_reservation.length > 0
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain + "." + request.domain
|
||||
@@ -444,7 +444,7 @@ class OrderReservation < ApplicationRecord
|
||||
else
|
||||
shop_code = ''
|
||||
end
|
||||
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time <= '#{Time.now.utc}'")
|
||||
order_reservation = OrderReservation.where("status='send_to_kitchen' and requested_time <= '#{Time.current.utc}'")
|
||||
if order_reservation.length > 0
|
||||
if ENV["SERVER_MODE"] == 'cloud'
|
||||
from = request.subdomain + "." + request.domain
|
||||
|
||||
@@ -12,13 +12,13 @@ class Promotion < ApplicationRecord
|
||||
PROMO_TYPE4 = "Percentage"
|
||||
|
||||
def is_promo_day
|
||||
promo_day.include? Date.today.wday.to_s
|
||||
promo_day.include? Date.current.wday.to_s
|
||||
end
|
||||
|
||||
def self.promo_activate(saleObj)
|
||||
current_day = Time.now.strftime("%Y-%m-%d")
|
||||
current_time = Time.now.strftime('%H:%M:%S')
|
||||
day = Date.today.wday
|
||||
current_day = Time.current.strftime("%Y-%m-%d")
|
||||
current_time = Time.current.strftime('%H:%M:%S')
|
||||
day = Date.current.wday
|
||||
promoList = is_between_promo_datetime(current_day,current_time)
|
||||
|
||||
promoList.each do |promo|
|
||||
|
||||
@@ -36,7 +36,7 @@ class Sale < ApplicationRecord
|
||||
|
||||
scope :receipt_date_between, -> (from, to) { where(receipt_date: from..to) }
|
||||
scope :sale_payments_with_audit_except_void_between, -> (from, to) do
|
||||
joins(sanitize_sql_array(["LEFT JOIN sale_payments ON sales.sale_status != 'void' AND sale_payments.sale_id = sales.sale_id AND sale_payments.created_at BETWEEN ? and ?", from, to]))
|
||||
joins(sanitize_sql_array(["LEFT JOIN sale_payments ON sales.sale_status != 'void' AND sale_payments.sale_id = sales.sale_id AND sale_payments.created_at BETWEEN ? and ?", from.utc, to.utc]))
|
||||
.joins("LEFT JOIN sale_audits ON sale_audits.sale_id = sale_payments.sale_id AND SUBSTRING_INDEX(sale_audits.remark,'||',1) = sale_payments.sale_payment_id")
|
||||
end
|
||||
|
||||
@@ -91,7 +91,7 @@ class Sale < ApplicationRecord
|
||||
def self.generate_invoice_from_booking(booking, requested_by, cashier, order_source = nil, in_duties_count = 0)
|
||||
Sale.transaction do
|
||||
if booking
|
||||
current = Time.now
|
||||
current = Time.current
|
||||
#get all order attached to this booking and combine into 1 invoice
|
||||
sale = booking.sale || booking.build_sale(
|
||||
{
|
||||
@@ -735,9 +735,9 @@ class Sale < ApplicationRecord
|
||||
|
||||
if from.present? && to.present?
|
||||
if shift.blank?
|
||||
sale = Sale.where("DATE_FORMAT(receipt_date,'%Y-%m-%d') >= ?" + " AND DATE_FORMAT(receipt_date,'%Y-%m-%d') <= ? and NOT sale_status = 'new' ", from,to)
|
||||
sale = Sale.where("receipt_date BETWEEN ? AND ? and NOT sale_status = 'new'", from,to)
|
||||
else
|
||||
sale = Sale.where("(DATE_FORMAT(receipt_date,'%Y-%m-%d') >= ?" + " AND DATE_FORMAT(receipt_date,'%Y-%m-%d') <= ? and NOT sale_status = 'new') and shift_sale_id = '#{shift.id}'", from,to)
|
||||
sale = Sale.where("receipt_date BETWEEN ? AND ? and NOT sale_status = 'new' and shift_sale_id = '#{shift.id}'", from,to)
|
||||
end
|
||||
query = sale.where(keyword)
|
||||
else
|
||||
@@ -1588,7 +1588,7 @@ end
|
||||
if !from.nil? && !to.nil?
|
||||
query = query.receipt_date_between(from, to)
|
||||
else
|
||||
query = query.receipt_date_between(Time.now.beginning_of_day, Time.now.end_of_day)
|
||||
query = query.receipt_date_between(Time.current.beginning_of_day, Time.current.end_of_day)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -1615,7 +1615,7 @@ end
|
||||
if !from.nil? && !to.nil?
|
||||
query = query.receipt_date_between(from, to)
|
||||
else
|
||||
query = query.receipt_date_between(Time.now.beginning_of_day, Time.now.end_of_day)
|
||||
query = query.receipt_date_between(Time.current.beginning_of_day, Time.current.end_of_day)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -1652,7 +1652,7 @@ end
|
||||
query = query.receipt_date_between(from, to)
|
||||
|
||||
else
|
||||
query = query.receipt_date_between(Time.now.beginning_of_day, Time.now.end_of_day)
|
||||
query = query.receipt_date_between(Time.current.beginning_of_day, Time.current.end_of_day)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -1673,7 +1673,7 @@ end
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.receipt_date_between(from, to)
|
||||
else
|
||||
query = query.receipt_date_between(Time.now.beginning_of_day, Time.now.end_of_day)
|
||||
query = query.receipt_date_between(Time.current.beginning_of_day, Time.current.end_of_day)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -1698,7 +1698,7 @@ end
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.merge(Sale.receipt_date_between(from, to))
|
||||
else
|
||||
query = query.merge(Sale.receipt_date_between(Time.now.beginning_of_day, Time.now.end_of_day))
|
||||
query = query.merge(Sale.receipt_date_between(Time.current.beginning_of_day, Time.current.end_of_day))
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -1719,7 +1719,7 @@ end
|
||||
query = query.receipt_date_between(from, to)
|
||||
|
||||
else
|
||||
query = query.receipt_date_between(Time.now.beginning_of_day, Time.now.end_of_day)
|
||||
query = query.receipt_date_between(Time.current.beginning_of_day, Time.current.end_of_day)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -1741,7 +1741,7 @@ end
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.receipt_date_between(from, to)
|
||||
else
|
||||
query = query.receipt_date_between(Time.now.beginning_of_day, Time.now.end_of_day)
|
||||
query = query.receipt_date_between(Time.current.beginning_of_day, Time.current.end_of_day)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -1772,7 +1772,7 @@ end
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.receipt_date_between(from, to)
|
||||
else
|
||||
query = query.receipt_date_between(Time.now.beginning_of_day, Time.now.end_of_day)
|
||||
query = query.receipt_date_between(Time.current.beginning_of_day, Time.current.end_of_day)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -1826,7 +1826,7 @@ end
|
||||
query = query.receipt_date_between(from, to)
|
||||
|
||||
else
|
||||
query = query.receipt_date_between(Time.now.beginning_of_day, Time.now.end_of_day)
|
||||
query = query.receipt_date_between(Time.current.beginning_of_day, Time.current.end_of_day)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -1848,7 +1848,7 @@ end
|
||||
query = query.receipt_date_between(from, to)
|
||||
|
||||
else
|
||||
query = query.receipt_date_between(Time.now.beginning_of_day, Time.now.end_of_day)
|
||||
query = query.receipt_date_between(Time.current.beginning_of_day, Time.current.end_of_day)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -1916,7 +1916,7 @@ end
|
||||
if (!from.nil? && !to.nil?)
|
||||
query = query.receipt_date_between(from, to)
|
||||
else
|
||||
query = query.receipt_date_between(Time.now.beginning_of_day, Time.now.end_of_day)
|
||||
query = query.receipt_date_between(Time.current.beginning_of_day, Time.current.end_of_day)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -1938,7 +1938,7 @@ end
|
||||
query = query.receipt_date_between(from, to)
|
||||
|
||||
else
|
||||
query = query.receipt_date_between(Time.now.beginning_of_day, Time.now.end_of_day)
|
||||
query = query.receipt_date_between(Time.current.beginning_of_day, Time.current.end_of_day)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -1960,7 +1960,7 @@ end
|
||||
query = query.receipt_date_between(from, to)
|
||||
|
||||
else
|
||||
query = query.receipt_date_between(Time.now.beginning_of_day, Time.now.end_of_day)
|
||||
query = query.receipt_date_between(Time.current.beginning_of_day, Time.current.end_of_day)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -1983,7 +1983,7 @@ end
|
||||
query = query.receipt_date_between(from, to)
|
||||
|
||||
else
|
||||
query = query.receipt_date_between(Time.now.beginning_of_day, Time.now.end_of_day)
|
||||
query = query.receipt_date_between(Time.current.beginning_of_day, Time.current.end_of_day)
|
||||
end
|
||||
|
||||
if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor')
|
||||
@@ -2060,7 +2060,7 @@ end
|
||||
query = query.joins("join sale_orders as sale_orders on sale_orders.sale_id = sales.sale_id")
|
||||
.joins("join orders as orders on orders.order_id = sale_orders.order_id")
|
||||
query = query.where("sales.sale_status != 'new' AND orders.status = 'billed' #{type}")
|
||||
query = query.receipt_date_between(Time.now.beginning_of_day, Time.now.end_of_day)
|
||||
query = query.receipt_date_between(Time.current.beginning_of_day, Time.current.end_of_day)
|
||||
.group("sales.sale_id")
|
||||
end
|
||||
|
||||
@@ -2138,7 +2138,7 @@ def self.employee_sale(shift=nil,from=nil,to=nil,from_time=nil,to_time=nil)
|
||||
if !from.nil? && !to.nil?
|
||||
query = query.receipt_date_between(from, to)
|
||||
else
|
||||
query = query.receipt_date_between(Time.now.beginning_of_day, Time.now.end_of_day)
|
||||
query = query.receipt_date_between(Time.current.beginning_of_day, Time.current.end_of_day)
|
||||
end
|
||||
|
||||
if !shift.nil?
|
||||
@@ -2162,8 +2162,8 @@ def self.get_by_hourly_items(shift_sale_range, shift, from, to, status,type,acco
|
||||
receipt_date = "sales.receipt_date between '#{from}' and '#{to}'"
|
||||
query = self.get_hourly_item_query(type,filter,true)
|
||||
else
|
||||
start_time = Time.parse(start_time).utc
|
||||
end_time = Time.parse(end_time).utc
|
||||
start_time = Time.zone.parse(start_time).utc
|
||||
end_time = Time.zone.parse(end_time).utc
|
||||
receipt_date = "sales.receipt_date between '#{start_time}' and '#{end_time}'"
|
||||
query = self.get_hourly_item_query(type,filter,false)
|
||||
end
|
||||
|
||||
@@ -223,7 +223,7 @@ class ShiftSale < ApplicationRecord
|
||||
end
|
||||
|
||||
if from.present? && to.present?
|
||||
booking = ShiftSale.where("DATE_FORMAT(created_at,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(created_at,'%d-%m-%Y') <= ? and NOT booking_status = 'void' ", from,to)
|
||||
booking = ShiftSale.where("created_at BETWEEN ? AND ? and NOT booking_status = 'void' ", from, to)
|
||||
query = booking.where(keyword)
|
||||
else
|
||||
where("booking_id LIKE ? OR checkin_by LIKE ? OR booking_status LIKE? OR checkout_by LIKE? OR sale_id ='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%")
|
||||
|
||||
@@ -4,8 +4,8 @@ class StockCheck < ApplicationRecord
|
||||
def create(user, reason, item_list)
|
||||
self.reason = reason
|
||||
self.check_by = user.id
|
||||
self.check_start = Time.now
|
||||
self.check_end = Time.now
|
||||
self.check_start = Time.current
|
||||
self.check_end = Time.current
|
||||
save
|
||||
item_list.each do |item|
|
||||
stockItem = StockCheckItem.new
|
||||
|
||||
@@ -8,7 +8,7 @@ class Survey < ApplicationRecord
|
||||
end
|
||||
|
||||
if from.present? && to.present?
|
||||
survey = Survey.where("DATE_FORMAT(created_at,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(created_at,'%d-%m-%Y') <= ?", from,to)
|
||||
survey = Survey.where("created_at BETWEEN ? AND ?", from, to)
|
||||
query = survey.where(keyword)
|
||||
else
|
||||
where("dining_name LIKE ?", "%#{filter}%")
|
||||
|
||||
@@ -13,8 +13,8 @@ if @zones
|
||||
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
|
||||
if !current_booking.nil?
|
||||
json.current_booking current_booking.booking_id
|
||||
json.checkin_at Time.parse(current_booking.checkin_at.strftime("%Y-%m-%d %H:%M:%S")).strftime("%Y-%m-%d %H:%M:%S")
|
||||
json.checkout_at current_booking.checkout_at ? Time.parse(current_booking.checkout_at.strftime("%Y-%m-%d %H:%M:%S")).strftime("%Y-%m-%d %H:%M:%S") : ""
|
||||
json.checkin_at current_booking.checkin_at.strftime("%Y-%m-%d %H:%M:%S")
|
||||
json.checkout_at current_booking.checkout_at ? current_booking.checkout_at.strftime("%Y-%m-%d %H:%M:%S") : ""
|
||||
else
|
||||
json.current_booking ""
|
||||
json.checkin_at ""
|
||||
@@ -32,8 +32,8 @@ if @zones
|
||||
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
|
||||
if !current_booking.nil?
|
||||
json.current_booking current_booking.booking_id
|
||||
json.checkin_at Time.parse(current_booking.checkin_at.strftime("%Y-%m-%d %H:%M:%S")).strftime("%Y-%m-%d %H:%M:%S")
|
||||
json.checkout_at current_booking.checkout_at ? Time.parse(current_booking.checkout_at.strftime("%Y-%m-%d %H:%M:%S")).strftime("%Y-%m-%d %H:%M:%S") : ""
|
||||
json.checkin_at current_booking.checkin_at.strftime("%Y-%m-%d %H:%M:%S")
|
||||
json.checkout_at current_booking.checkout_at ? current_booking.checkout_at.strftime("%Y-%m-%d %H:%M:%S") : ""
|
||||
else
|
||||
json.current_booking ""
|
||||
json.checkin_at ""
|
||||
@@ -53,8 +53,8 @@ else #list all tables and rooms with out zones
|
||||
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
|
||||
if !current_booking.nil?
|
||||
json.current_booking current_booking.booking_id
|
||||
json.checkin_at Time.parse(current_booking.checkin_at.strftime("%Y-%m-%d %H:%M:%S")).strftime("%Y-%m-%d %H:%M:%S")
|
||||
json.checkout_at current_booking.checkout_at ? Time.parse(current_booking.checkout_at.strftime("%Y-%m-%d %H:%M:%S")).strftime("%Y-%m-%d %H:%M:%S") : ""
|
||||
json.checkin_at current_booking.checkin_at.strftime("%Y-%m-%d %H:%M:%S")
|
||||
json.checkout_at current_booking.checkout_at ? current_booking.checkout_at.strftime("%Y-%m-%d %H:%M:%S") : ""
|
||||
else
|
||||
json.current_booking ""
|
||||
json.checkin_at ""
|
||||
@@ -72,8 +72,8 @@ else #list all tables and rooms with out zones
|
||||
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
|
||||
if !current_booking.nil?
|
||||
json.current_booking current_booking.booking_id
|
||||
json.checkin_at Time.parse(current_booking.checkin_at.strftime("%Y-%m-%d %H:%M:%S")).strftime("%Y-%m-%d %H:%M:%S")
|
||||
json.checkout_at current_booking.checkout_at ? Time.parse(current_booking.checkout_at.strftime("%Y-%m-%d %H:%M:%S")).strftime("%Y-%m-%d %H:%M:%S") : ""
|
||||
json.checkin_at current_booking.checkin_at.strftime("%Y-%m-%d %H:%M:%S")
|
||||
json.checkout_at current_booking.checkout_at ? current_booking.checkout_at.strftime("%Y-%m-%d %H:%M:%S") : ""
|
||||
else
|
||||
json.current_booking ""
|
||||
json.checkin_at ""
|
||||
|
||||
@@ -70,13 +70,13 @@
|
||||
from_date = @from.strftime("%d-%m-%Y")
|
||||
from_time = @from.strftime("%H:%M") if @from.strftime("%H:%M") != "00:00"
|
||||
else
|
||||
from_date = Time.now.strftime('%d-%m-%Y')
|
||||
from_date = Time.current.strftime('%d-%m-%Y')
|
||||
end
|
||||
if !@to.nil? && @to != ""
|
||||
to_date = @to.strftime("%d-%m-%Y")
|
||||
to_time = @to.strftime("%H:%M") if @to.strftime("%H:%M") != "23:59"
|
||||
else
|
||||
to_date = Time.now.strftime('%d-%m-%Y')
|
||||
to_date = Time.current.strftime('%d-%m-%Y')
|
||||
end
|
||||
%>
|
||||
<div class="col-lg-3 col-md-3 col-sm-3 col-mbl-view mbl-style">
|
||||
|
||||
@@ -477,7 +477,7 @@
|
||||
<!-- Footer -->
|
||||
<div class="legal">
|
||||
<div class="copyright">
|
||||
© <%= Time.now.strftime("%Y") %> <a href="javascript:void(0);">Code2Lab</a>.
|
||||
© <%= Time.current.strftime("%Y") %> <a href="javascript:void(0);">Code2Lab</a>.
|
||||
</div>
|
||||
<div class="version">
|
||||
<b>Version: </b> 1.0.1
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<%= qsi.station_name %>
|
||||
<% if @filter.nil? %>
|
||||
<span class="badge bg-blue-grey oqs_count<%= i%> oqs_count" data-id="<%= qsi.id %>" id="completed_count">
|
||||
<!-- <span class="badge badge-pill badge-default oqs_count<%= i%> oqs_count" data-id="<%= qsi.id %>"> --> <%= qsi.assigned_order_items.where("delivery_status=0 AND created_at >= '#{Time.now.beginning_of_day.utc}'").count %>
|
||||
<!-- <span class="badge badge-pill badge-default oqs_count<%= i%> oqs_count" data-id="<%= qsi.id %>"> --> <%= qsi.assigned_order_items.where("delivery_status=0 AND created_at >= '#{Time.current.beginning_of_day.utc}'").count %>
|
||||
</span>
|
||||
<%else%>
|
||||
<span class="label-count badge bg-blue-grey" data-id="<%= qsi.id %>">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<% renewable_date = current_license.read_license("renewable_date") %>
|
||||
<% date_count = (renewable_date.to_date - Date.today).to_i %>
|
||||
<% date_count = (renewable_date.to_date - Date.current).to_i %>
|
||||
<% day = pluralize( date_count, 'day' )%>
|
||||
|
||||
<% if @license_status == 0 %>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<% license_status = current_license.detail_with_local_file %>
|
||||
<% renewable_date = current_license.read_license("renewable_date") %>
|
||||
<% date_count = (renewable_date.to_date - Date.today).to_i %>
|
||||
<% date_count = (renewable_date.to_date - Date.current).to_i %>
|
||||
<% day = pluralize( date_count, 'day' )%>
|
||||
|
||||
<% if license_status == 0
|
||||
|
||||
Reference in New Issue
Block a user