diff --git a/app/models/license.rb b/app/models/license.rb index 37ed5149..0f2fd0ed 100755 --- a/app/models/license.rb +++ b/app/models/license.rb @@ -18,39 +18,21 @@ class License if (server != "") self.class.base_uri server end - - # @secret = ENV["aes_key"] - # @params = { query: { device: "SX", token: SECRETS_CONFIG['provision_key'] } } end + # For Cloud def detail_with_local_cache(lookup) - aes = MyAesCrypt.new aes_key, aes_iv = aes.export_to_file(lookup) - # flag = ENV["AES_IV"] - # # Check Exists IV - # if flag == "<%= ENV['AES_IV'] %>" - # # Export for Key - # aes = MyAesCrypt.new - # aes_key, aes_iv = aes.export_key(lookup) - # else - # aes_key = ENV["AES_KEY"] - # aes_iv = ENV["AES_IV"] - # end - ##Check from local redis - if available load local otherwise get from remote - cache_key = "#{lookup}:license:#{aes_key}:hostname" - # No Needs for current - # @secret = key + ##Check from local redis - if available load local otherwise get from remote + cache_key = "#{lookup}:license:#{aes_key}:hostname" cache_license = nil ##Get redis connection from connection pool redis = Redis.new - cache_license = redis.get(cache_key) - # Redis.current do |conn| - # cache_license = conn.get(cache_key) - # end + cache_license = redis.get(cache_key) Rails.logger.info "Cache key - " + cache_key.to_s if cache_license.nil? @@ -85,7 +67,7 @@ class License end end - + # For Local System def detail_with_local_file() has_license = true # verify_license() @@ -117,8 +99,7 @@ class License end def verify_license - api_token = read_license_no_decrypt("api_token") - puts api_token + api_token = read_license_no_decrypt("api_token") @params = { query: {lookup_type: "application", api_token: api_token} } response = self.class.get("/verify", @params) @varified = response.parsed_response diff --git a/app/models/sale.rb b/app/models/sale.rb index fbd22da2..a1367b98 100755 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -979,7 +979,8 @@ end def self.hourly_sales(today) query= Sale.select("grand_total") .where('payment_status="paid" and sale_status = "completed" and DATE_FORMAT(receipt_date,"%Y-%m-%d") = ?',today) - .group("date_format(receipt_date, '%I %p')") + .group("date_format(CONVERT_TZ(receipt_date,'+00:00', 'SYSTEM'), '%I %p')") + .order('receipt_date') end def self.employee_sales(today) diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 7fbc9c60..b2ffe0c3 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -390,10 +390,11 @@ $(this).off("click"); var sale_id = $('#sale_id').text(); var item_row = $('.is_card'); + if (item_row.length < 1) { calculate_member_discount(sale_id); } - + // payment var cash = $('#cash').text(); var credit = $('#credit').text();