From 7d105b27897a3d11d5999c52bc7cca4bbe68c617 Mon Sep 17 00:00:00 2001 From: NyanLinHtut Date: Fri, 24 May 2019 14:56:08 +0630 Subject: [PATCH] fixed grand total at receipt no report --- app/models/sale.rb | 1 + .../_shift_sale_report_filter.html.erb | 34 ++--- app/views/reports/receipt_no/index.html.erb | 136 +++++++++--------- app/views/reports/shiftsale/index.html.erb | 2 +- config/initializers/action_controller.rb | 61 ++++---- config/puma.rb | 3 +- 6 files changed, 120 insertions(+), 117 deletions(-) diff --git a/app/models/sale.rb b/app/models/sale.rb index 7ce7e11e..ef38e8b2 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -879,6 +879,7 @@ def self.daily_sales_list(from,to) total_sale.each do |sale| grand_total = sale.grand_total + amount_received = sale.amount_received old_grand_total = sale.old_grand_total total_discount = sale.total_discount void_amount = sale.void_amount diff --git a/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb b/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb index 6cf8ce02..a54afb7f 100755 --- a/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb +++ b/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb @@ -19,10 +19,10 @@ <% if not defined? payments %> - +
- + -
+ <% end %> -
+
@@ -47,36 +47,36 @@
-
-
+
+ -
-
+
+ <% end %> - <% end %> - + <% end %> + \ No newline at end of file + diff --git a/app/views/reports/shiftsale/index.html.erb b/app/views/reports/shiftsale/index.html.erb index 6068347b..529636b9 100755 --- a/app/views/reports/shiftsale/index.html.erb +++ b/app/views/reports/shiftsale/index.html.erb @@ -90,7 +90,7 @@ - <%= result[:cashier_terminal_name] rescue '-'%> <%= result[:shift_id].to_i %> + <%= result[:cashier_terminal_name] rescue '-'%> <%= result[:employee_name] rescue '-'%> diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index fb212f13..196f8751 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -3,45 +3,45 @@ class ActionController::Base private - def lookup_domain - if request.subdomain.present? && request.subdomain != "www" - from = request.subdomain.downcase + "." + request.domain.downcase + def lookup_domain + if request.subdomain.present? && request.subdomain != "www" + from = request.subdomain.downcase + "." + request.domain.downcase @license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase if (!@license.nil?) - logger.info "Location - " + @license.dbschema - ActiveRecord::Base.establish_connection(website_connection(@license)) - # authenticate_session_token + logger.info "Location - " + @license.dbschema + ActiveRecord::Base.establish_connection(website_connection(@license)) + # authenticate_session_token # logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema else # reconnect_default_db logger.info 'License is nil' # redirect_to root_url(:host => request.domain) + "store_error" render :json => [{ status: false, message: 'Invalid Access!'}] - end - else - # check for license file + end + else + check for license file if check_license current_license(ENV["SX_PROVISION_URL"]) else redirect_to activate_path - end - end + end + end end - def current_license(url) + def current_license(url) @license = License.new(url) flag = @license.detail_with_local_file() if (flag == 0) - flash[:notice] = 'Expired or No License!' + flash[:notice] = 'Expired or No License!' elsif (flag == 2) - flash[:notice] = 'Expiring! Please, License extend...' + flash[:notice] = 'Expiring! Please, License extend...' else puts "RUN SAY BYAR" end end - def cache_license(url, lookup) - @license = License.new(url, lookup) + def cache_license(url, lookup) + @license = License.new(url, lookup) if (@license.detail_with_local_cache(lookup) == true) return @license @@ -51,7 +51,7 @@ class ActionController::Base end def check_license - License.check_license_file + License.check_license_file end def check_installation @@ -83,7 +83,7 @@ class ActionController::Base # RESTful url for localize def default_url_options { locale: I18n.locale } - end + end end @@ -92,26 +92,26 @@ class ActionController::API private - def lookup_domain - if request.subdomain.present? && request.subdomain != "www" - from = request.subdomain.downcase + "." + request.domain.downcase + def lookup_domain + if request.subdomain.present? && request.subdomain != "www" + from = request.subdomain.downcase + "." + request.domain.downcase @license = cache_license(ENV["SX_PROVISION_URL"], from) # request.subdomain.downcase if (!@license.nil?) - logger.info "Location - " + @license.dbschema - ActiveRecord::Base.establish_connection(website_connection(@license)) - # authenticate_session_token + logger.info "Location - " + @license.dbschema + ActiveRecord::Base.establish_connection(website_connection(@license)) + # authenticate_session_token # logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema else # reconnect_default_db logger.info 'License is nil' # redirect_to root_url(:host => request.domain) + "store_error" render :json => [{ status: false, message: 'Invalid Access!'}] - end - end - end + end + end + end - def cache_license(url, lookup) - @license = License.new(url, lookup) + def cache_license(url, lookup) + @license = License.new(url, lookup) if (@license.detail_with_local_cache(lookup) == true) return @license @@ -143,7 +143,6 @@ class ActionController::API # RESTful url for localize def default_url_options { locale: I18n.locale } - end + end end - diff --git a/config/puma.rb b/config/puma.rb index 6f7c4941..7a12c8c2 100755 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,7 +1,6 @@ application_path="#{File.expand_path("../..", __FILE__)}" directory application_path -# environment ENV.fetch("RAILS_ENV") { "production" } -environment "production" +#environment "production" pidfile "#{application_path}/tmp/puma/pid" state_path "#{application_path}/tmp/puma/state" stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"