update search data in transaction

This commit is contained in:
Aung Myo
2017-11-21 18:29:41 +06:30
parent 01bf7caeb5
commit 3041d6a368
11 changed files with 224 additions and 219 deletions

View File

@@ -14,20 +14,21 @@ class Transactions::CreditNotesController < ApplicationController
to = params[:to]
if filter.nil? && from.nil? && to.nil? && customer.nil?
@sales = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
@credit_notes = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
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(20)
@credit_notes = sale
@credit_notes = Kaminari.paginate_array(@credit_notes).page(params[:page]).per(20)
else
@sales = 0
@credit_notes = 0
end
end
puts "sssssssssssss"
puts @credit_notes.to_json
respond_to do |format|
format.html # index.html.erb
format.json { render json: @sales }
format.json { render json: @credit_notes }
end
end