latest Aston req from OPT team
This commit is contained in:
@@ -11,7 +11,7 @@ class Transactions::SalesController < ApplicationController
|
||||
to = params[:to]
|
||||
|
||||
if receipt_no.nil? && from.nil? && to.nil?
|
||||
@sales = Sale.order("sale_id desc")
|
||||
@sales = Sale.where("NOT sale_status='new'").order("sale_id desc")
|
||||
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20)
|
||||
else
|
||||
sale = Sale.search(receipt_no,from,to)
|
||||
@@ -45,6 +45,24 @@ class Transactions::SalesController < ApplicationController
|
||||
# end
|
||||
# end
|
||||
|
||||
@sale_audits = []
|
||||
@sale_item_audits = []
|
||||
if !@sales.nil?
|
||||
@sales.each do |sale|
|
||||
sale_audit = SaleAudit.where("(action = 'SALEPAYMENT' or action = 'SALEVOID') and sale_id = ? and remark IS NOT NULL",sale.sale_id)
|
||||
if !sale_audit.nil?
|
||||
sale_audit.each do |audit|
|
||||
@sale_audits.push({sale.sale_id => audit.remark})
|
||||
end
|
||||
end
|
||||
|
||||
sale_item_audit = SaleAudit.where("(action LIKE '%ITEM%') and sale_id = ?",sale.sale_id)
|
||||
if !sale_item_audit.nil? && sale_item_audit.count > 0
|
||||
@sale_item_audits.push({sale.sale_id => sale_item_audit.count})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @sales }
|
||||
|
||||
@@ -1,5 +1,28 @@
|
||||
class Transactions::SurveysController < ApplicationController
|
||||
def index
|
||||
@surveys = Survey.all
|
||||
filter = params[:filter]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
|
||||
if filter.nil? && from.nil? && to.nil?
|
||||
surveys = Survey.all
|
||||
else
|
||||
surveys = Survey.search(filter,from,to)
|
||||
end
|
||||
|
||||
if !surveys.nil?
|
||||
@surveys = Kaminari.paginate_array(surveys).page(params[:page]).per(20)
|
||||
else
|
||||
@surveys = []
|
||||
end
|
||||
|
||||
@filter = filter
|
||||
@from = from
|
||||
@to = to
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @surveys }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user