shop code filter for all reports and transactions

This commit is contained in:
Myat Zin Wai Maw
2019-11-26 12:06:52 +06:30
parent d1ab2c194d
commit 5dd4c6e7b6
26 changed files with 281 additions and 260 deletions

View File

@@ -9,11 +9,11 @@ class Transactions::OrdersController < ApplicationController
to = params[:to]
if filter.nil? && from.nil? && to.nil?
orders = Order.order("order_id desc")
orders = Order.where("shop_code='#{@shop.shop_code}'").order("order_id desc")
else
orders = Order.search(filter,from,to)
end
orders = Order.search(filter,from,to).where("orders.shop_code='#{@shop.shop_code}'")
end
if !orders.nil?
@orders = Kaminari.paginate_array(orders).page(params[:page]).per(20)
else
@@ -23,14 +23,14 @@ class Transactions::OrdersController < ApplicationController
@receipt_no = filter
@from = from
@to = to
respond_to do |format|
format.html
format.json { render json: @orders }
# format.csv { send_data OrdersCsvExport.generate }
end
end
def show
@order = Order.find(params[:id])