update filter in sale and order and creditnote

This commit is contained in:
Aung Myo
2017-08-08 09:43:58 +06:30
parent 35d1ec59cb
commit 285ad93501
10 changed files with 208 additions and 57 deletions

View File

@@ -5,9 +5,25 @@ class Transactions::CreditNotesController < ApplicationController
# GET /transactions/sales.json
def index
@sales = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
@customers = Customer.all
filter = params[:filter]
customer = params[:customer]
from = params[:from]
to = params[:to]
if filter.nil? && from.nil? && to.nil? && customer.nil?
@sales = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
puts "cccccccccccc"
else
sale = Sale.search_credit_sales(customer,filter,from,to)
if sale.count > 0
@sales = sale
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
else
@sales = 0
end
end
respond_to do |format|
format.html # index.html.erb