barcode update

This commit is contained in:
nandar
2018-07-26 09:33:05 +06:30
parent 8dc9ab0fbe
commit 004f801f71
15 changed files with 284 additions and 158 deletions

View File

@@ -9,16 +9,19 @@ class BatchLineItemsController < ApplicationController
@product_category_id=""
@clients=Client.all.order('id desc')
@product_categories=ProductCategory.all.order('id desc')
@sellers=User.where("user_type=?","Seller")
find_client=Client.select(:id).order('id desc').last
if !find_client.nil?
client_id=find_client.id
find_batch=Batch.where('client_id=?',client_id).order('id desc').first
if !find_batch.nil?
@product_category_id=find_batch.product_category_id
end
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
@@ -76,6 +79,7 @@ class BatchLineItemsController < ApplicationController
@batches=Batch.where('user_id=?',user_id)
client_id=params[:client]
product_category_id=params[:product_category]
seller_id = params[:seller]
find_client=Client.find_by_id(client_id)
location_code=find_client.location_code
client_name=find_client.name.downcase
@@ -91,7 +95,7 @@ class BatchLineItemsController < ApplicationController
end
if !batch_list.empty?
res=Batch.where("client_id=? and product_category_id=? and id in (?)",client_id,product_category_id,batch_list).update_all("export_count = export_count + 1,exported_by='"+exported_by+"'")
res=Batch.where("client_id=? and product_category_id=? and id in (?)",client_id,product_category_id,batch_list).update_all("export_count = export_count + 1,exported_by='"+exported_by+"',export_to_seller_id='"+seller_id+"'")
sub_query= "(select * from batches where client_id="+client_id.to_s+" and product_category_id="+ product_category_id.to_s+")"
@@ -101,7 +105,7 @@ class BatchLineItemsController < ApplicationController
.where('batch_id in (?)',batch_list)
.select("*,product.product_type_id ,product.name,'' as secret_token,'' as location_name")
else
Batch.where("client_id=? ",client_id).update_all("export_count = export_count + 1,exported_by='"+exported_by+"'")
Batch.where("client_id=? ",client_id).update_all("export_count = export_count + 1,exported_by='"+exported_by+"',export_to_seller_id='"+seller_id+"'")
sub_query="(select * from batches where client_id ="+client_id+" and product_category_id="+ product_category_id+")"
@batchLineItems = BatchLineItem.joins('inner join '+sub_query+' as batches on batches.id=batch_line_items.batch_id')
.joins('inner join product_categories as product on product.id=batches.product_category_id')