shop code filter for all reports and transactions
This commit is contained in:
@@ -12,17 +12,17 @@ class Transactions::OrderReservationsController < ApplicationController
|
||||
if from.nil? && to.nil?
|
||||
@order_reservations = OrderReservation.select("order_reservations.*, deliveries.provider, deliveries.delivery_fee")
|
||||
.joins(" JOIN deliveries on deliveries.order_reservation_id = order_reservations.order_reservation_id")
|
||||
.where("NOT order_reservation_status='new'")
|
||||
.where("NOT order_reservation_status='new' and order_reservations.shop_code='#{@shop.shop_code}'")
|
||||
.order("order_reservation_id desc")
|
||||
@order_reservations = Kaminari.paginate_array(@order_reservations).page(params[:page]).per(20)
|
||||
else
|
||||
order_reservation = OrderReservation.search(filter,from,to)
|
||||
order_reservation = OrderReservation.search(filter,from,to).where("order_reservations.shop_code='#{@shop.shop_code}'")
|
||||
if order_reservation.length > 0
|
||||
@order_reservations = order_reservation
|
||||
@order_reservations = order_reservation
|
||||
@order_reservations = Kaminari.paginate_array(@order_reservations).page(params[:page]).per(20)
|
||||
else
|
||||
@order_reservations = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
@from = from
|
||||
@to = to
|
||||
@@ -38,7 +38,7 @@ class Transactions::OrderReservationsController < ApplicationController
|
||||
# GET /transactions/order_reservations/1
|
||||
# GET /transactions/order_reservations/1.json
|
||||
def show
|
||||
|
||||
|
||||
@order_reservation = OrderReservation.select("order_reservations.*, deliveries.provider, deliveries.delivery_fee")
|
||||
.joins(" JOIN deliveries on deliveries.order_reservation_id = order_reservations.order_reservation_id")
|
||||
.where("order_reservations.order_reservation_id = ?", params[:id])
|
||||
@@ -73,7 +73,7 @@ class Transactions::OrderReservationsController < ApplicationController
|
||||
period_type = params[:period_type]
|
||||
period = params[:period]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
to = params[:to]
|
||||
day_ref = Time.now.utc.getlocal
|
||||
|
||||
if from.present? && to.present?
|
||||
@@ -82,8 +82,8 @@ class Transactions::OrderReservationsController < ApplicationController
|
||||
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
|
||||
else
|
||||
to = t_time.end_of_day.utc.getlocal
|
||||
else
|
||||
case period.to_i
|
||||
when PERIOD["today"]
|
||||
from = day_ref.beginning_of_day.utc
|
||||
@@ -117,10 +117,10 @@ class Transactions::OrderReservationsController < ApplicationController
|
||||
when PERIOD["last_year"]
|
||||
from = (day_ref - 1.year).beginning_of_year.utc
|
||||
to = (day_ref - 1.year).end_of_year.utc
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return from, to
|
||||
return from, to
|
||||
end
|
||||
|
||||
def check_user
|
||||
@@ -128,7 +128,7 @@ class Transactions::OrderReservationsController < ApplicationController
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_transactions_order_reservation
|
||||
|
||||
Reference in New Issue
Block a user