From 4baff5918cc642883d0f6782d1030f9a90ef54ff Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Mon, 14 May 2018 10:50:04 +0630 Subject: [PATCH] update addorder sale item xls --- app/views/reports/saleitem/index.xls.erb | 23 ++++++++++++++++------- config/initializers/action_controller.rb | 10 +++++----- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/app/views/reports/saleitem/index.xls.erb b/app/views/reports/saleitem/index.xls.erb index 85c666a5..82b11aef 100755 --- a/app/views/reports/saleitem/index.xls.erb +++ b/app/views/reports/saleitem/index.xls.erb @@ -59,16 +59,18 @@ <% unless @sale_data.blank? %> <% @sale_data.each do |sale| %> - + <% if sale.status_type == "Discount" + total_qty += sale.total_item*(-1) + end %> - + <% if !acc_arr.include?(sale.account_id) %> <%= sale.account_name %> @@ -103,7 +105,12 @@ <% end %> <%= sale.item_code rescue '-' %> <%= sale.product_name rescue '-' %> - <%= sale.total_item rescue '-' %> + <% if sale.status_type != "Discount" %> + <%= sale.total_item rescue '-' %> + <%else%> + <%= sale.total_item*(-1) rescue '-' %> + <% end %> + <%= number_with_precision(sale.unit_price , precision:precision.to_i,delimiter:delimiter) rescue '-'%> <%= number_with_precision(sale.grand_total , precision:precision.to_i,delimiter:delimiter) rescue '-'%> @@ -114,10 +121,12 @@ <% count = count + 1 %> <% sub_total += sale.grand_total %> <% #sub_qty += sale.total_item %> - <% if sale.status_type!="Discount" && (!sale.product_name.include? "FOC") + <% if sale.status_type !="Discount" && (!sale.product_name.include? "FOC") sub_qty += sale.total_item end %> - + <% if sale.status_type =="Discount" + sub_qty += sale.total_item*(-1) + end %> <% if count == value %>   diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index b84bca54..e0eb7455 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -20,11 +20,11 @@ class ActionController::Base end else #check for license file - # if check_license - # current_license(ENV["SX_PROVISION_URL"]) - # else - # redirect_to activate_path - # end + if check_license + current_license(ENV["SX_PROVISION_URL"]) + else + redirect_to activate_path + end end end