fix timezone
This commit is contained in:
@@ -40,15 +40,15 @@ class Api::CheckInProcessController < Api::ApiController
|
||||
lookup_checkout_time = Lookup.collection_of("checkout_alert_time")
|
||||
|
||||
if !lookup_checkout_time.empty?
|
||||
now = Time.current
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
arr_time = checkout_time[0].split("-")
|
||||
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
|
||||
end
|
||||
now = Time.now.utc
|
||||
lookup_checkout_time.each do |checkout_time|
|
||||
arr_time = checkout_time[0].split("-")
|
||||
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
|
||||
end
|
||||
render :json => { :status => true, :check_in_time => check_in_time, :check_out_time => check_out_time, :alert_time_min => alert_time_min, :extra_minutes => extra_minutes }
|
||||
else
|
||||
render :json => { :status => true }
|
||||
|
||||
@@ -35,7 +35,7 @@ class Api::ShiftsController < Api::ApiController
|
||||
@shift = ShiftSale.find_by_id(shift_id)
|
||||
if !@shift.nil?
|
||||
if @shift.shift_closed_at.nil?
|
||||
@shift.shift_closed_at = DateTime.now.utc
|
||||
@shift.shift_closed_at = Time.current
|
||||
@shift.closing_balance = closing_balance.to_f
|
||||
@shift.save
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ class BaseReportController < ActionController::Base
|
||||
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"]
|
||||
|
||||
@@ -5,9 +5,9 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
# GET /crm/dining_queues
|
||||
# GET /crm/dining_queues.json
|
||||
def index
|
||||
today = DateTime.now.strftime('%Y-%m-%d')
|
||||
@dining_queues = DiningQueue.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and status is NULL ", today).order("queue_no asc")
|
||||
@complete_queue = DiningQueue.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and status = 'Assign' ", today).order("queue_no asc")
|
||||
today = Time.current.strftime('%Y-%m-%d')
|
||||
@dining_queues = DiningQueue.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status is NULL ", today).order("queue_no asc")
|
||||
@complete_queue = DiningQueue.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status = 'Assign' ", today).order("queue_no asc")
|
||||
|
||||
if params[:term]
|
||||
@customer = Customer.order(:name).where('lower(name) LIKE ?', "%#{params[:term].downcase}%")
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
class Crm::HomeController < BaseCrmController
|
||||
def index
|
||||
|
||||
|
||||
@booking = Booking.all
|
||||
@customer = Customer.all
|
||||
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
|
||||
redirect_to crm_customers_path
|
||||
# .where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||
|
||||
end
|
||||
@@ -16,12 +16,12 @@ class Crm::HomeController < BaseCrmController
|
||||
|
||||
#print for crm
|
||||
def print_order
|
||||
|
||||
|
||||
@booking = Booking.find(params[:id])
|
||||
|
||||
@total_amount = 0.00
|
||||
@total_tax = 0.00
|
||||
|
||||
|
||||
if @booking.booking_orders
|
||||
order_items = []
|
||||
@booking.booking_orders.each do |bo|
|
||||
@@ -32,14 +32,14 @@ class Crm::HomeController < BaseCrmController
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
# unique_code="CrmOrderPdf"
|
||||
|
||||
# print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
|
||||
# printer.print_crm_order(@booking,order_items,print_settings)
|
||||
# printer.print_crm_order(@booking,order_items,print_settings)
|
||||
|
||||
end
|
||||
|
||||
@@ -53,8 +53,7 @@ class Crm::HomeController < BaseCrmController
|
||||
# else
|
||||
# render json: JSON.generate({:status => false, :error_message => "Record not found"})
|
||||
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ class Foodcourt::FoodCourtController < ApplicationController
|
||||
@tables = Table.active.order('status desc')
|
||||
@rooms = Room.active.order('status desc')
|
||||
|
||||
today = DateTime.now
|
||||
today = Time.current
|
||||
day = Date.today.wday
|
||||
@menus = []
|
||||
@menu = []
|
||||
|
||||
@@ -7,7 +7,7 @@ class Foodcourt::HomeController < BaseFoodcourtController
|
||||
@tables = Table.unscoped.all.active.order('status desc')
|
||||
@rooms = Room.unscoped.all.active.order('status desc')
|
||||
@complete = Sale.completed_sale("cashier")
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(CONVERT_TZ(date,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",Time.current.strftime('%Y-%m-%d')).order('date desc')
|
||||
|
||||
@customers = Customer.pluck("customer_id, name")
|
||||
@occupied_table = DiningFacility.where("status='occupied'").count
|
||||
@@ -22,7 +22,7 @@ class Foodcourt::HomeController < BaseFoodcourtController
|
||||
@tables = Table.unscoped.all.active.order('status desc')
|
||||
@rooms = Room.unscoped.all.active.order('status desc')
|
||||
@complete = Sale.completed_sale("cashier")
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(CONVERT_TZ(date,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",Time.current.strftime('%Y-%m-%d')).order('date desc')
|
||||
@customers = Customer.pluck("customer_id, name")
|
||||
@shift = ShiftSale.current_open_shift(current_user)
|
||||
|
||||
@@ -33,8 +33,8 @@ class Foodcourt::HomeController < BaseFoodcourtController
|
||||
@membership = MembershipSetting::MembershipSetting
|
||||
@payment_methods = PaymentMethodSetting.all
|
||||
|
||||
@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("created_at between '#{DateTime.now.utc - 12.hours}' and '#{DateTime.now.utc}'")
|
||||
@dining_booking = @dining.bookings.active.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = '#{Time.current.strftime('%Y-%m-%d')}' OR DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = '#{Date.today.prev_day}' ")
|
||||
|
||||
@order_items = Array.new
|
||||
@dining_booking.each do |booking|
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
|
||||
@@ -7,8 +7,8 @@ class Foodcourt::OrdersController < BaseFoodcourtController
|
||||
|
||||
@tables = Table.unscoped.all.active.order('status desc')
|
||||
@rooms = Room.unscoped.all.active.order('status desc')
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
@complete = Sale.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and sale_status != 'new'",Time.not.utc.strftime('%Y-%m-%d'))
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",Time.current.strftime('%Y-%m-%d')).order('date desc')
|
||||
@order = Order.find(params[:order_id])
|
||||
booking = Booking.select('bookings.booking_id, bookings.dining_facility_id')
|
||||
.joins(" JOIN booking_orders as bo on bo.booking_id = bookings.booking_id")
|
||||
@@ -100,7 +100,7 @@ class Foodcourt::OrdersController < BaseFoodcourtController
|
||||
@rooms = Room.active.order('status desc')
|
||||
|
||||
@cashier_type = "food_court"
|
||||
today = DateTime.now
|
||||
today = Time.current
|
||||
day = Date.today.wday
|
||||
|
||||
@menus = []
|
||||
@@ -214,7 +214,7 @@ class Foodcourt::OrdersController < BaseFoodcourtController
|
||||
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.now
|
||||
induty.save
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ class Foodcourt::SalesController < BaseFoodcourtController
|
||||
@tables = Table.unscoped.all.active.order('status desc')
|
||||
@rooms = Room.unscoped.all.active.order('status desc')
|
||||
@complete = Sale.completed_sale("cashier")
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(CONVERT_TZ(date,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",Time.current.strftime('%Y-%m-%d')).order('date desc')
|
||||
@customers = Customer.pluck("customer_id, name")
|
||||
@sale = Sale.find(params[:sale_id])
|
||||
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
|
||||
@@ -29,7 +29,7 @@ class Foodcourt::SalesController < BaseFoodcourtController
|
||||
sale_data = []
|
||||
table = DiningFacility.find(dining)
|
||||
existing_booking = Booking.find_by_sale_id(sale_id)
|
||||
table.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}' ").each do |booking|
|
||||
table.bookings.active.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = '#{Time.current.strftime('%Y-%m-%d')}' OR DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = '#{Date.today.prev_day}' ").each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
order_array = []
|
||||
booking.booking_orders.each do |booking_order|
|
||||
|
||||
@@ -46,7 +46,7 @@ class Foodcourt::ShiftsController < BaseFoodcourtController
|
||||
shift_id = params[:shift_id]
|
||||
@shift = ShiftSale.find_by_id(shift_id)
|
||||
if @shift
|
||||
@shift.shift_closed_at = DateTime.now.utc
|
||||
@shift.shift_closed_at = Time.now
|
||||
@shift.closing_balance = closing_balance.to_f
|
||||
@shift.save
|
||||
|
||||
|
||||
@@ -4,15 +4,15 @@ class Induties::AssignInDutiesController < ApplicationController
|
||||
@commiss=Commissioner.active.all.order(created_at: :desc)
|
||||
@commiss.each do|commissioner|
|
||||
check_in_count =InDuty.where('commissioner_ids =? and out_time is null', commissioner.id.to_json).count;
|
||||
@commissioners.push({ "id"=>commissioner.id,
|
||||
@commissioners.push({ "id"=>commissioner.id,
|
||||
"name"=>commissioner.name,
|
||||
"image_path"=>commissioner.image_path.url,
|
||||
"check_in_count"=>check_in_count
|
||||
})
|
||||
|
||||
|
||||
end
|
||||
@booking_id = params[:booking_id]
|
||||
|
||||
|
||||
end
|
||||
|
||||
def get_all_occupied_dining
|
||||
@@ -32,10 +32,10 @@ class Induties::AssignInDutiesController < ApplicationController
|
||||
induty.booking_id = booking_id
|
||||
induty.commissioner_ids = commissioner_ids
|
||||
induty.by_name = params[:by_name]
|
||||
induty.in_time = Time.current
|
||||
induty.in_time = Time.now
|
||||
if induty.save
|
||||
dinning = DiningFacility.find(induty.dinning_id)
|
||||
@induty= {"id"=>induty.id,
|
||||
@induty= {"id"=>induty.id,
|
||||
"dinning_id"=>induty.dinning_id,
|
||||
"in_time"=>induty.in_time,
|
||||
"out_time"=>induty.out_time,
|
||||
|
||||
@@ -249,7 +249,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 = #{status} AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' ")
|
||||
# .where("assigned_order_items.delivery_status = #{status} AND assigned_order_items.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("oqs.id")
|
||||
|
||||
|
||||
@@ -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.current.strftime("%Y-%m-%d")
|
||||
card_settle_trans.req_time = Time.current
|
||||
card_settle_trans.req_date = Date.today
|
||||
card_settle_trans.req_time = Time.now
|
||||
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.current.strftime("%Y-%m-%d")
|
||||
card_settle_trans.res_time = Time.current
|
||||
card_settle_trans.res_date = Date.today
|
||||
card_settle_trans.res_time = Time.now
|
||||
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.current.strftime("%Y-%m-%d")
|
||||
card_sale_trans.req_time = Time.current
|
||||
card_sale_trans.req_date = Date.today
|
||||
card_sale_trans.req_time = Time.now
|
||||
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]
|
||||
|
||||
@@ -14,7 +14,7 @@ class Origami::CheckInProcessController < BaseOrigamiController
|
||||
checkout_at = checkout_at + (checkout_time[1]).to_i.minutes
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if checkout_at.strftime("%Y-%m-%d %H:%M%p") > today.strftime("%Y-%m-%d %H:%M%p")
|
||||
@dining_facility = DiningFacility.find(params[:dining_id])
|
||||
|
||||
@@ -23,9 +23,9 @@ class Origami::CheckInProcessController < BaseOrigamiController
|
||||
# else
|
||||
# type = "RoomBooking"
|
||||
# end
|
||||
|
||||
|
||||
@booking = Booking.create({:dining_facility_id => params[:dining_id],:type => "TableBooking",
|
||||
: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 })
|
||||
: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)
|
||||
|
||||
@@ -40,13 +40,13 @@ class Origami::CheckInProcessController < BaseOrigamiController
|
||||
booking = Booking.find_by_booking_id(@booking.booking_id)
|
||||
table = DiningFacility.find(params[:dining_id])
|
||||
|
||||
# print when complete click
|
||||
# print when complete click
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(printer)
|
||||
|
||||
if !printer.nil?
|
||||
order_queue_printer.print_check_in_out(printer, cashier_terminal, booking, table)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -8,8 +8,8 @@ class Origami::CreditSalesController < BaseOrigamiController
|
||||
|
||||
@tables = Table.unscope(:order).all.active.order('status desc')
|
||||
@rooms = Room.unscope(:order).all.active.order('status desc')
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
@complete = Sale.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and sale_status != 'new'",Time.current.strftime('%Y-%m-%d'))
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",Time.current.strftime('%Y-%m-%d')).order('date desc')
|
||||
@customers = Customer.pluck("customer_id, name")
|
||||
|
||||
@sale = Sale.find_by_sale_id(params[:sale_id])
|
||||
|
||||
@@ -8,7 +8,7 @@ class Origami::FoodCourtController < ApplicationController
|
||||
end
|
||||
|
||||
def index
|
||||
today = DateTime.now
|
||||
today = Time.current
|
||||
day = Date.current.wday
|
||||
# if params[:menu] == "true"
|
||||
@menus = []
|
||||
@@ -47,7 +47,7 @@ class Origami::FoodCourtController < ApplicationController
|
||||
|
||||
def modify_order
|
||||
@cashier_type = "food_court"
|
||||
today = DateTime.now
|
||||
today = Time.current
|
||||
day = Date.current.wday
|
||||
# if params[:menu] == "true"
|
||||
@menus = []
|
||||
|
||||
@@ -7,7 +7,7 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@tables = Table.unscope(:order).includes(:zone, :current_checkin_booking, :current_checkout_booking, :current_reserved_booking).active.order('status desc')
|
||||
@rooms = Room.unscope(:order).includes(:zone, :current_checkin_booking, :current_checkout_booking, :current_reserved_booking).active.order('status desc')
|
||||
@complete = Sale.completed_sale("cashier")
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(CONVERT_TZ(date,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",Time.current.strftime('%Y-%m-%d')).order('date desc')
|
||||
|
||||
|
||||
@customers = Customer.pluck("customer_id, name")
|
||||
@@ -24,7 +24,7 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@tables = Table.unscope(:order).includes(:zone, :current_checkin_booking, :current_checkout_booking, :current_reserved_booking).all.active.order('status desc')
|
||||
@rooms = Room.unscope(:order).includes(:zone, :current_checkin_booking, :current_checkout_booking, :current_reserved_booking).all.active.order('status desc')
|
||||
@complete = Sale.completed_sale("cashier")
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(CONVERT_TZ(date,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",Time.current.strftime('%Y-%m-%d')).order('date desc')
|
||||
|
||||
@customers = Customer.pluck("customer_id, name")
|
||||
@shift = ShiftSale.current_open_shift(current_user)
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
class Origami::MoveroomController < BaseOrigamiController
|
||||
|
||||
|
||||
authorize_resource :class => false
|
||||
|
||||
|
||||
def move_dining
|
||||
@webview = check_mobile
|
||||
|
||||
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
@complete = Sale.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and sale_status != 'new'",Time.current.strftime('%Y-%m-%d'))
|
||||
@orders = Order.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status != 'billed'",Time.current.strftime('%Y-%m-%d')).order('date desc')
|
||||
|
||||
@status_order = ""
|
||||
@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.current.prev_day}' ")
|
||||
@dining_room = @dining.bookings.active.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = '#{Time.current.strftime('%Y-%m-%d')}' OR DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = '#{Date.current.prev_day}' ")
|
||||
@dining_room.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
@order_items = Array.new
|
||||
|
||||
@@ -7,15 +7,15 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
|
||||
@tables = Table.all.active.order('status desc')
|
||||
@rooms = Room.all.active.order('status desc')
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
@complete = Sale.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and sale_status != 'new'",Time.current.strftime('%Y-%m-%d'))
|
||||
@orders = Order.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status != 'billed'",Time.current.strftime('%Y-%m-%d')).order('date desc')
|
||||
@dining = DiningFacility.find(params[:dining_id])
|
||||
|
||||
@status_order = ""
|
||||
@status_sale = ""
|
||||
@sale_array = Array.new
|
||||
|
||||
@dining_booking = @dining.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.current.prev_day}' ")
|
||||
@dining_booking = @dining.bookings.active.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = '#{Time.current.strftime('%Y-%m-%d')}' OR DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = '#{Date.current.prev_day}' ")
|
||||
|
||||
@dining_booking.each do |booking|
|
||||
if booking.sale_id.nil?
|
||||
@@ -32,7 +32,7 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
@order_items.push(item)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
accounts = @customer.tax_profiles
|
||||
@account_arr =[]
|
||||
accounts.each do |acc|
|
||||
@@ -69,11 +69,11 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
|
||||
def moving
|
||||
change_to = params[:change_to] #new
|
||||
change_from = params[:change_from] #original
|
||||
change_from = params[:change_from] #original
|
||||
|
||||
# bookings = Booking.where('dining_facility_id=?',change_from)
|
||||
|
||||
bookings = Booking.where("((DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.current.prev_day}')) AND dining_facility_id='#{change_from}'")
|
||||
bookings = Booking.where("((DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = '#{Time.current.strftime('%Y-%m-%d')}' OR DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = '#{Date.current.prev_day}')) AND dining_facility_id='#{change_from}'")
|
||||
|
||||
booking_array = Array.new
|
||||
order_items = Array.new
|
||||
@@ -85,13 +85,13 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
|
||||
booking.booking_orders.each do |booking_order|
|
||||
order = Order.find(booking_order.order_id)
|
||||
if order.status == 'new'
|
||||
if order.status == 'new'
|
||||
oqs = OrderQueueStation.new
|
||||
oqs.process_order(order, change_from, order.source, 'move',change_to,current_user.name)
|
||||
# order.order_items.each do |order_item|
|
||||
# order_items.push(order_item)
|
||||
# end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -104,9 +104,9 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
# @to = (DiningFacility.find(change_to)).name
|
||||
# @type = (DiningFacility.find(change_to)).type
|
||||
# @moved_by = @current_user.name
|
||||
# @date = DateTime.now
|
||||
# @date = Time.current
|
||||
# @shop = @shop
|
||||
# unique_code = "MoveTablePdf"
|
||||
# unique_code = "MoveTablePdf"
|
||||
# pdf_no = PrintSetting.where(:unique_code => unique_code).count
|
||||
# #print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
# printer_array = []
|
||||
@@ -115,15 +115,15 @@ class Origami::MovetableController < BaseOrigamiController
|
||||
# for i in 0..pdf_no
|
||||
# if i != pdf_no
|
||||
# print_settings = printer_array[i]
|
||||
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
# printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
# printer.print_move_table(print_settings,@to,@from ,@shop,@date,@type,@moved_by,order_items)
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
type = 'move'
|
||||
from = getCloudDomain #get sub domain in cloud mode
|
||||
ActionCable.server.broadcast "order_channel",table: change_from,type:type,from:from ,change_to:change_to
|
||||
ActionCable.server.broadcast "order_channel",table: change_from,type:type,from:from ,change_to:change_to
|
||||
end
|
||||
|
||||
#get cloud domain
|
||||
|
||||
@@ -2,13 +2,13 @@ class Origami::OrdersController < BaseOrigamiController
|
||||
def show
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@webview = true
|
||||
@webview = true
|
||||
end
|
||||
|
||||
|
||||
@tables = Table.unscope(:order).all.active.order('status desc')
|
||||
@rooms = Room.unscope(:order).all.active.order('status desc')
|
||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
@complete = Sale.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and sale_status != 'new'",Time.current.strftime('%Y-%m-%d'))
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",Time.current.strftime('%Y-%m-%d')).order('date desc')
|
||||
@order = Order.find(params[:order_id])
|
||||
booking = Booking.select('bookings.booking_id, bookings.dining_facility_id')
|
||||
.joins(" JOIN booking_orders as bo on bo.booking_id = bookings.booking_id")
|
||||
@@ -22,7 +22,7 @@ class Origami::OrdersController < BaseOrigamiController
|
||||
else
|
||||
@booking.push({'booking_id' => booking.booking_id, 'dining_facility_id' => booking.dining_facility_id, 'type' => nil})
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@customers = Customer.pluck("customer_id, name")
|
||||
#for split bill
|
||||
@@ -39,7 +39,7 @@ class Origami::OrdersController < BaseOrigamiController
|
||||
@sale_status = sale.sale_status
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@order.order_items.each_with_index do |item, order_item_index|
|
||||
if !item.set_menu_items.nil?
|
||||
instance_item_sets = JSON.parse(item.set_menu_items)
|
||||
@@ -52,7 +52,7 @@ class Origami::OrdersController < BaseOrigamiController
|
||||
@order.order_items[order_item_index].set_menu_items = arr_instance_item_sets
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# bookings = Booking.all
|
||||
# if !bookings.today.nil?
|
||||
# @order_items_count = Hash.new
|
||||
@@ -85,5 +85,5 @@ class Origami::OrdersController < BaseOrigamiController
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Origami::PendingOrderController < BaseOrigamiController
|
||||
def index
|
||||
# @dining= DiningFacility.where("status = 'occupied'")
|
||||
# @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d'))
|
||||
# @order = Order.where("DATE_FORMAT(CONVERT_TZ(date,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",Time.current.strftime('%Y-%m-%d'))
|
||||
@cashier_type = params[:type]
|
||||
@sale = Sale.pending_sale(@cashier_type)
|
||||
@order = Sale.pending_order(@cashier_type)
|
||||
|
||||
@@ -8,7 +8,7 @@ class Origami::QuickServiceController < ApplicationController
|
||||
end
|
||||
|
||||
def index
|
||||
today = DateTime.now
|
||||
today = Time.current
|
||||
day = Date.current.wday
|
||||
|
||||
@menus = []
|
||||
@@ -46,7 +46,7 @@ class Origami::QuickServiceController < ApplicationController
|
||||
|
||||
def modify_order
|
||||
@cashier_type = "quick_service"
|
||||
today = DateTime.now
|
||||
today = Time.current
|
||||
day = Date.current.wday
|
||||
# if params[:menu] == "true"
|
||||
@menus = []
|
||||
|
||||
@@ -4,7 +4,7 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
@tables = Table.unscope(:order).all.active.order('status desc')
|
||||
@rooms = Room.unscope(:order).all.active.order('status desc')
|
||||
@complete = Sale.completed_sale("cashier")
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(CONVERT_TZ(date,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",Time.current.strftime('%Y-%m-%d')).order('date desc')
|
||||
@shift = ShiftSale.current_open_shift(current_user)
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@@ -22,7 +22,7 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
@tables = Table.unscope(:order).all.active.order('status desc')
|
||||
@rooms = Room.unscope(:order).all.active.order('status desc')
|
||||
@complete = Sale.completed_sale("cashier")
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(CONVERT_TZ(date,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",Time.current.strftime('%Y-%m-%d')).order('date desc')
|
||||
@customers = Customer.pluck("customer_id, name")
|
||||
@room = DiningFacility.find(params[:room_id])
|
||||
@shift = ShiftSale.current_open_shift(current_user)
|
||||
@@ -33,8 +33,8 @@ 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.current.prev_day}' ")
|
||||
|
||||
@dining_room = @room.bookings.active.where("DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = '#{Time.current.strftime('%Y-%m-%d')}' OR DATE_FORMAT(CONVERT_TZ(created_at,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = '#{Date.current.prev_day}' ")
|
||||
@order_items = Array.new
|
||||
@dining_room.each do |booking|
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
|
||||
@@ -9,7 +9,7 @@ class Origami::SalesController < BaseOrigamiController
|
||||
@tables = Table.unscope(:order).all.active.order('status desc')
|
||||
@rooms = Room.unscope(:order).all.active.order('status desc')
|
||||
@complete = Sale.completed_sale("cashier")
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(CONVERT_TZ(date,'+00:00', Time.zone.formatted_offset),'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",Time.current.strftime('%Y-%m-%d')).order('date desc')
|
||||
@customers = Customer.pluck("customer_id, name")
|
||||
@sale = Sale.find(params[:sale_id])
|
||||
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
|
||||
@@ -31,7 +31,7 @@ class Origami::SalesController < BaseOrigamiController
|
||||
Sale.transaction do
|
||||
table = DiningFacility.find(dining)
|
||||
booking = table.current_checkin_booking
|
||||
|
||||
|
||||
sale = Sale.find(sale_id)
|
||||
existing = sale.booking
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class Origami::ShiftsController < BaseOrigamiController
|
||||
shift_id = params[:shift_id]
|
||||
@shift = ShiftSale.find_by_id(shift_id)
|
||||
if @shift
|
||||
@shift.shift_closed_at = DateTime.now.utc
|
||||
@shift.shift_closed_at = Time.current.utc
|
||||
@shift.closing_balance = closing_balance.to_f
|
||||
@shift.save
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ class Reports::StockCheckController < BaseReportController
|
||||
|
||||
def index
|
||||
|
||||
# from_date = DateTime.now.beginning_of_day
|
||||
# to_date = DateTime.now.end_of_day
|
||||
# from_date = Time.current.beginning_of_day
|
||||
# to_date = Time.current.end_of_day
|
||||
# unless params[:daterange].blank?
|
||||
# from_date = Date.parse(params[:daterange].split(' - ')[0]).beginning_of_day
|
||||
# to_date = Date.parse(params[:daterange].split(' - ')[1]).end_of_day
|
||||
|
||||
@@ -20,7 +20,7 @@ class Settings::OutOfStockController < ApplicationController
|
||||
}
|
||||
|
||||
item_instance = MenuItemInstance.where(item_instance_code: [items_arr])
|
||||
date = DateTime.now
|
||||
date = Time.current
|
||||
|
||||
unless item_instance.nil?
|
||||
if !item_instance.first.is_out_of_stock?
|
||||
|
||||
@@ -17,8 +17,8 @@ class Settings::PromotionsController < ApplicationController
|
||||
# GET /promotions/new
|
||||
def new
|
||||
@promotion = Promotion.new
|
||||
@promotion.promo_start_date = DateTime.now
|
||||
@promotion.promo_end_date = DateTime.now
|
||||
@promotion.promo_start_date = Time.current
|
||||
@promotion.promo_end_date = Time.current
|
||||
end
|
||||
|
||||
# GET /promotions/1/edit
|
||||
|
||||
@@ -5,31 +5,31 @@ class Transactions::CardSettleTransController < ApplicationController
|
||||
# GET /transactions/sales.json
|
||||
def index
|
||||
@status = [["All Status",''], ["Approved","Approved"], ["Declined","Declined"]]
|
||||
@payment_method = [["All Payments",''],["MPU Payment","mpu"], ["Visa & Master Payment","vmj"],
|
||||
["JCB Payment","jcb"],["UnionPay Payment","cup"],
|
||||
@payment_method = [["All Payments",''],["MPU Payment","mpu"], ["Visa & Master Payment","vmj"],
|
||||
["JCB Payment","jcb"],["UnionPay Payment","cup"],
|
||||
["Alipay Payment","alipay"]]
|
||||
@sales = Sale.all
|
||||
|
||||
payment_type = params[:payment_type]
|
||||
cashier_name = params[:cashier_name]
|
||||
status_type = params[:status_type]
|
||||
|
||||
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
if cashier_name.nil? && from.nil? && to.nil? && payment_method.nil? && status_type.nil?
|
||||
|
||||
|
||||
@cardSettles = CardSettleTran.order("sale_id desc")
|
||||
|
||||
|
||||
@cardSettles = Kaminari.paginate_array(@cardSettles).page(params[:page]).per(20)
|
||||
else
|
||||
cardSettle = CardSettleTran.search(cashier_name,from,to,payment_type,status_type)
|
||||
if cardSettle.count > 0
|
||||
@cardSettles = cardSettle
|
||||
@cardSettles = cardSettle
|
||||
@cardSettles = Kaminari.paginate_array(@cardSettles).page(params[:page]).per(20)
|
||||
else
|
||||
@cardSettles = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -49,51 +49,51 @@ class Transactions::CardSettleTransController < ApplicationController
|
||||
}
|
||||
|
||||
def get_date_range_from_params
|
||||
period_type = params[:period_type]
|
||||
period = params[:period]
|
||||
|
||||
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
|
||||
period_type = params[:period_type]
|
||||
period = params[:period]
|
||||
|
||||
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
|
||||
|
||||
from = from.beginning_of_day
|
||||
to = to.end_of_day
|
||||
from = from.beginning_of_day
|
||||
to = to.end_of_day
|
||||
|
||||
return from, to
|
||||
return from, to
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user