change migration file
This commit is contained in:
@@ -62,6 +62,9 @@ class HomeController < ApplicationController
|
||||
end
|
||||
|
||||
def dashboard
|
||||
# puts "date range =>"
|
||||
# puts get_date_range_from_params
|
||||
|
||||
@shop = Shop.first
|
||||
|
||||
today = DateTime.now.strftime('%Y-%m-%d')
|
||||
@@ -162,4 +165,20 @@ class HomeController < ApplicationController
|
||||
redirect_to reports_dailysale_index_path
|
||||
end
|
||||
end
|
||||
|
||||
def get_date_range_from_params
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
|
||||
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.utc.getlocal
|
||||
to = t_time.end_of_day.utc.getlocal
|
||||
end
|
||||
|
||||
return from, to
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user