From 8deb8ea401b0adc136e506652167a01ee8691f35 Mon Sep 17 00:00:00 2001 From: nandar Date: Fri, 4 Aug 2017 17:19:50 +0630 Subject: [PATCH] show location code in client list --- .DS_Store | Bin 6148 -> 6148 bytes .../batch_line_items_controller.rb | 4 ++-- app/views/clients/index.html.erb | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.DS_Store b/.DS_Store index e926c64fdb8a34488c7b21942938544a2901df7e..24bd82133bb5ab01fe79670b0694693deb3d945e 100644 GIT binary patch delta 19 acmZoMXfc=&$H=fTem^54!)AG=r=kEpn+5j( delta 19 acmZoMXfc=&$H=%bem^54<7RoLr=kEptp)i2 diff --git a/app/controllers/batch_line_items_controller.rb b/app/controllers/batch_line_items_controller.rb index 9454cd2..1dedb52 100644 --- a/app/controllers/batch_line_items_controller.rb +++ b/app/controllers/batch_line_items_controller.rb @@ -10,7 +10,7 @@ class BatchLineItemsController < ApplicationController @clients=Client.all.order('id desc') @product_categories=ProductCategory.all.order('id desc') - find_client=Client.select(:id).order('id desc').first + find_client=Client.select(:id).order('id desc').last if !find_client.nil? client_id=find_client.id @@ -18,7 +18,7 @@ class BatchLineItemsController < ApplicationController 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+" )" + 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) else diff --git a/app/views/clients/index.html.erb b/app/views/clients/index.html.erb index c1787c3..5e75da3 100644 --- a/app/views/clients/index.html.erb +++ b/app/views/clients/index.html.erb @@ -21,7 +21,8 @@ Name Email Phone - Address + Address + Location Code Created At Action @@ -32,7 +33,8 @@ <%= client.name rescue '' %> <%= client.email rescue '' %> <%= client.phone rescue '' %> - <%= client.address rescue '' %> + <%= client.address rescue '' %> + <%= client.location_code rescue '' %> <%= client.created_at.strftime("%e,%b %Y %I:%M %p") rescue '' %> <%= link_to 'Detail',