diff --git a/10 b/10 deleted file mode 100644 index e69de29b..00000000 diff --git a/Can't open membership server } b/Can't open membership server } deleted file mode 100644 index e69de29b..00000000 diff --git a/app/models/customer.rb b/app/models/customer.rb index 4db65146..d69220f3 100755 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -18,36 +18,39 @@ class Customer < ApplicationRecord paginates_per 50 def self.get_member_account(customer) - membership = MembershipSetting.find_by_membership_type("paypar_url") - memberaction = MembershipAction.find_by_membership_type("get_all_member_account") + membership = MembershipSetting.active.find_by_membership_type("paypar_url") + memberaction = MembershipAction.active.find_by_membership_type("get_all_member_account") merchant_uid = memberaction.merchant_account_id.to_s auth_token = memberaction.auth_token.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s # urltest =self.url_exist?(url) + if !membership.nil? && !memberaction.nil? + begin + response = HTTParty.get(url, :body => { + membership_id: customer.membership_id, + merchant_uid:merchant_uid, + type: "summary", + auth_token:auth_token + }.to_json, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json; version=3' + }, + :timeout => 10) + rescue HTTParty::Error + response = {status: false, message: "Server Error"} + + rescue Net::OpenTimeout + response = { status: false , message: "Server Time out"} - begin - response = HTTParty.get(url, :body => { - membership_id: customer.membership_id, - merchant_uid:merchant_uid, - type: "summary", - auth_token:auth_token - }.to_json, - :headers => { - 'Content-Type' => 'application/json', - 'Accept' => 'application/json; version=3' - }, - :timeout => 10) - rescue HTTParty::Error - response = {status: false, message: "Server Error"} - - rescue Net::OpenTimeout - response = { status: false , message: "Server Time out"} + rescue OpenURI::HTTPError + response = { status: false, message: "Can't connect server"} - rescue OpenURI::HTTPError - response = { status: false, message: "Can't connect server"} - - rescue SocketError - response = { status: false, message: "Can't connect server"} + rescue SocketError + response = { status: false, message: "Can't connect server"} + end + else + response = {status: false, message: "There is no membership setting."} end Rails.logger.debug "--------Get Member Account response -------" Rails.logger.debug response.to_json diff --git a/app/models/sale_item.rb b/app/models/sale_item.rb index c69e3626..c44220b1 100755 --- a/app/models/sale_item.rb +++ b/app/models/sale_item.rb @@ -180,10 +180,10 @@ class SaleItem < ApplicationRecord def self.get_all_sale_items(sale_id) sale_items = SaleItem.select("sale_id,product_code,item_instance_code, product_name,product_alt_name,account_id,status,remark, - (CASE WHEN (qty > 0 AND remark IS NULL) OR (qty < 0 AND status = 'foc') OR (qty < 0 AND status='Discount') OR (status='promotion' AND (remark='promotion' OR remark = 'promotion nett price' OR remark= 'promotion discount')) THEN SUM(qty) ELSE qty END) as qty, + (CASE WHEN (qty > 0 AND remark IS NULL) OR (qty > 0 AND status='foc') OR (qty < 0 AND status = 'foc') OR (qty < 0 AND status='Discount') OR (status='promotion' AND (remark='promotion' OR remark = 'promotion nett price' OR remark= 'promotion discount')) THEN SUM(qty) ELSE qty END) as qty, unit_price, taxable_price, - (CASE WHEN (price > 0 AND remark IS NULL) OR (qty < 0 AND status = 'foc') OR (price < 0 AND status='Discount') OR (status='promotion' AND (remark='promotion' OR remark = 'promotion nett price' OR remark= 'promotion discount')) THEN SUM(price) ELSE price END) as price, + (CASE WHEN (price > 0 AND remark IS NULL) OR (qty > 0 AND status='foc') OR (qty < 0 AND status = 'foc') OR (price < 0 AND status='Discount') OR (status='promotion' AND (remark='promotion' OR remark = 'promotion nett price' OR remark= 'promotion discount')) THEN SUM(price) ELSE price END) as price, is_taxable") .where("sale_id = ?",sale_id) .order("product_name asc") diff --git a/app/pdf/close_cashier_pdf.rb b/app/pdf/close_cashier_pdf.rb index 2a42a98d..541c6df4 100755 --- a/app/pdf/close_cashier_pdf.rb +++ b/app/pdf/close_cashier_pdf.rb @@ -175,6 +175,7 @@ class CloseCashierPdf < Prawn::Document bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do text "#{number_with_precision(shift_sale.credit_sales, :precision => precision.to_i, :delimiter => delimiter) }", :size => self.item_font_size, :align => :right end + #start other payment details if shift_sale.other_sales > 0 other_payment.each do |other| diff --git a/app/pdf/crm_order_pdf.rb b/app/pdf/crm_order_pdf.rb index f9367907..978f7137 100755 --- a/app/pdf/crm_order_pdf.rb +++ b/app/pdf/crm_order_pdf.rb @@ -35,7 +35,7 @@ class CrmOrderPdf < Prawn::Document end header( printer_settings.printer_name, printer_settings.name) - stroke_horizontal_rule + stroke_horizontal_rule cashier_info(booking) line_items(order_items) diff --git a/app/pdf/order_summary_pdf.rb b/app/pdf/order_summary_pdf.rb index f093b6bc..fd446131 100755 --- a/app/pdf/order_summary_pdf.rb +++ b/app/pdf/order_summary_pdf.rb @@ -66,7 +66,7 @@ class OrderSummaryPdf < Prawn::Document move_down 5 y_position = cursor bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do - text "OrderNo: #{order_no} ", :size => self.item_font_size,:align => :left + text "OrderNo: #{order_no}", :size => self.item_font_size,:align => :left end move_down 5 diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index cde5e3d0..29d93ca7 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -721,7 +721,6 @@ $(document).ready(function(){ var sale_id = $('#sale_id').text(); window.location.replace('/origami/sale/'+sale_id+'/cashier/payment'); } - /* replace url type*/ /* start check first bill or not*/ var member_id = $('#membership_id').text(); @@ -1125,6 +1124,8 @@ $(document).ready(function(){ <% else %> $('#balance').text(parseFloat(result)); <% end %> + + show_hide_btn($('#balance').text()); } function customer_display_view(data,status) { @@ -1831,4 +1832,15 @@ $(document).ready(function(){ } },100); }); + + function show_hide_btn(balance) { + // show discount when balance is greater than 0 + // if(parseFloat(balance) > 0){ + // $("#discount").show(); + // $("#edit").show(); + // }else{ + // $("#discount").hide(); + // $("#edit").hide(); + // } + } diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index cab8fe5d..fb212f13 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 diff --git a/config/puma.rb b/config/puma.rb index fbe48c81..6f7c4941 100755 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,10 +1,10 @@ -#application_path="#{File.expand_path("../..", __FILE__)}" -#directory application_path -#environment ENV.fetch("RAILS_ENV") { "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" -#port ENV.fetch("PORT") { 62158 } -#workers 2 -#preload_app! +application_path="#{File.expand_path("../..", __FILE__)}" +directory application_path +# environment ENV.fetch("RAILS_ENV") { "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" +port ENV.fetch("PORT") { 62158 } +workers 2 +preload_app! diff --git a/dump.rdb b/dump.rdb index 87e22f1d..3ad69d64 100644 Binary files a/dump.rdb and b/dump.rdb differ diff --git a/false, b/false, deleted file mode 100644 index e69de29b..00000000 diff --git a/member_params, b/member_params, deleted file mode 100644 index e69de29b..00000000 diff --git a/{ b/{ deleted file mode 100644 index e69de29b..00000000