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

@@ -18,13 +18,13 @@ class Transactions::SalesController < ApplicationController
if receipt_no.nil? && from.nil? && to.nil?
if @shift.blank?
@sales = Sale.where("NOT sale_status='new'").order("sale_id desc")
@sales = Sale.where("NOT sale_status='new' and shop_code='#{@shop.shop_code}'").order("sale_id desc")
else
@sales = Sale.where("NOT sale_status='new' and shift_sale_id ='#{@shift.id}'").order("sale_id desc")
@sales = Sale.where("NOT sale_status='new' and shift_sale_id ='#{@shift.id}' and shop_code='#{@shop.shop_code}'").order("sale_id desc")
end
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
else
sale = Sale.search(receipt_no,from,to,@shift)
sale = Sale.search(receipt_no,from,to,@shift).where("sales.shop_code='#{@shop.shop_code}'")
if sale.count > 0
@sales = sale
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)