users clients batchlineItem fix

This commit is contained in:
KhinSuLinn
2017-10-25 14:04:01 +06:30
parent dce9c48eef
commit 3488ac3ac7
11 changed files with 55 additions and 39 deletions

View File

@@ -21,13 +21,16 @@ class BatchLineItemsController < ApplicationController
sub_query="(select * from batches where client_id="+client_id.to_s+" and product_category_id ="+@product_category_id.to_s+" )"
@batchLineItems=BatchLineItem.joins('inner join '+sub_query+' as batches on batches.id=batch_line_items.batch_id')
.select('batch_line_items.*,batches.order_ref as batch_name').order('batch_line_items.id desc').page(params[:page]).per(10)
@result_count= @batchLineItems.total_count
else
@batchLineItems=BatchLineItem.joins('inner join batches on batches.id=batch_line_items.batch_id')
.select('batch_line_items.*,batches.order_ref as batch_name').order('batch_line_items.id desc').page(params[:page]).per(10)
@result_count= @batchLineItems.total_count
end
end
def search
# user_id=current_member.user_id
# user_id=current_member.user_id
batch_list=params[:batch]
client_id=params[:client]
product_category_id=params[:product_category]
@@ -40,12 +43,12 @@ class BatchLineItemsController < ApplicationController
@batchLineItems=BatchLineItem.joins('inner join '+ sub_query +' as batches on batches.id=batch_line_items.batch_id')
.select('batch_line_items.*,batches.order_ref as batch_name').order('batch_line_items.id desc').page(params[:page]).per(10)
@result_count= @batchLineItems.total_count
else
sub_query="(select * from batches where client_id="+client_id.to_s+" and product_category_id="+product_category_id.to_s+")"
@batchLineItems=BatchLineItem.joins('inner join '+ sub_query +'as batches on batches.id=batch_line_items.batch_id')
.select('batch_line_items.*,batches.order_ref as batch_name').order('batch_line_items.id desc').page(params[:page]).per(10)
@result_count= @batchLineItems.total_count
end
# if @batchLineItems.nil?