From 93085271a92b0dfe6a756bb0a3e859cd401941e9 Mon Sep 17 00:00:00 2001 From: Sunandar Date: Mon, 20 Feb 2017 12:47:49 +0630 Subject: [PATCH] edit --- app/controllers/batch_line_items_controller.rb | 8 ++++++-- app/views/batch_line_items/index.html.erb | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controllers/batch_line_items_controller.rb b/app/controllers/batch_line_items_controller.rb index da0a025..9454cd2 100644 --- a/app/controllers/batch_line_items_controller.rb +++ b/app/controllers/batch_line_items_controller.rb @@ -76,6 +76,9 @@ class BatchLineItemsController < ApplicationController product_category_id=params[:product_category] find_client=Client.find_by_id(client_id) location_code=find_client.location_code + client_name=find_client.name.downcase + find_product=ProductCategory.find_by_id(product_category_id) + product_name=find_product.name.downcase find_user=User.find_by_id(user_id) if !find_user.nil? @@ -103,10 +106,11 @@ class BatchLineItemsController < ApplicationController .select("*,product.product_type_id ,product.name,'' as secret_token,'' as location") end - + datestr= Time.now.strftime("%Y/%m/%d %H:%M:%S") + filename=client_name.to_s+"_"+product_name.to_s+"_"+datestr respond_to do |format| format.html - format.csv { send_data @batchLineItems.to_csv(client_id,location_code), filename: "encoder-#{Date.today}.csv" } + format.csv { send_data @batchLineItems.to_csv(client_id,location_code), filename: "#{filename}.csv" } end end end \ No newline at end of file diff --git a/app/views/batch_line_items/index.html.erb b/app/views/batch_line_items/index.html.erb index 725f2d3..745d7c4 100644 --- a/app/views/batch_line_items/index.html.erb +++ b/app/views/batch_line_items/index.html.erb @@ -28,7 +28,7 @@ -
+
Batch Line Item List