diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 560b43f3..ec8a6958 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -168,7 +168,7 @@ class Origami::PaymentsController < BaseOrigamiController # salePayment = SalePayment.find(sale_payment_id) # salePayment.process_kbz_payment(salePayment.sale_id, sale_data.grand_total, cash, 'paid') # else - # sp = SalePayment.where('sale_id=? and payment_method=? and payment_status=?', sale_id, 'kbzpay', 'paid').last + sp = SalePayment.where('sale_id=? and payment_method=? and payment_status=?', sale_id, 'kbzpay', 'paid').last if is_kbz == 'false' Rails.logger.info '################ CASH PAYMENT #################' sale_payment = SalePayment.new @@ -177,6 +177,8 @@ class Origami::PaymentsController < BaseOrigamiController else sale_payment.process_payment(saleObj, current_user, cash, "cash") end + else + sp.kbz_edit_sale_payment(sp.received_amount.to_f, current_user) end # end diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index db44dd10..53d9f1cc 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -177,6 +177,11 @@ class SalePayment < ApplicationRecord end + def kbz_edit_sale_payment(amt, action_by) + self.action_by = action_by + sale_update_payment_status(amt) + end + def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token) # Control for Paypar Cloud begin @@ -625,7 +630,7 @@ class SalePayment < ApplicationRecord self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f self.payment_status = "paid" payment_status = self.save! - sale_update_payment_status(self.received_amount) + # sale_update_payment_status(self.received_amount) return payment_status end diff --git a/app/models/shift_sale.rb b/app/models/shift_sale.rb index 59294700..1749e1b8 100755 --- a/app/models/shift_sale.rb +++ b/app/models/shift_sale.rb @@ -157,6 +157,7 @@ class ShiftSale < ApplicationRecord SUM(case when (sale_payments.payment_method='jcb') then (sale_payments.payment_amount) else 0 end) as jcb_amount, SUM(case when (sale_payments.payment_method='unionpay') then (sale_payments.payment_amount) else 0 end) as unionpay_amount, SUM(case when (sale_payments.payment_method='alipay') then (sale_payments.payment_amount) else 0 end) as alipay_amount, + SUM(case when (sale_payments.payment_method='KBZPay') then (sale_payments.payment_amount) else 0 end) as kbzpay_amount, SUM(case when (sale_payments.payment_method='dinga') then (sale_payments.payment_amount) else 0 end) as dinga_amount, SUM(case when (sale_payments.payment_method='giftvoucher') then (sale_payments.payment_amount) else 0 end) as giftvoucher_amount, SUM(case when (sale_payments.payment_method='JunctionPay') then (sale_payments.payment_amount) else 0 end) as junctionpay_amount, diff --git a/app/pdf/close_cashier_pdf.rb b/app/pdf/close_cashier_pdf.rb index 9ff2f17a..d4564291 100755 --- a/app/pdf/close_cashier_pdf.rb +++ b/app/pdf/close_cashier_pdf.rb @@ -244,6 +244,16 @@ class CloseCashierPdf < Prawn::Document end end + if other.kbzpay_amount && other.kbzpay_amount.to_f > 0 + y_position = cursor + bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do + text "KBZ Payment :", :size => self.item_font_size, :align => :right + end + bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do + text "#{ number_with_precision(other.kbzpay_amount, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size, :align => :right + end + end + if other.junctionpay_amount && other.junctionpay_amount.to_f > 0 y_position = cursor bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index 85f38ec5..205c330a 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -21,11 +21,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 6a545bed..fd89392f 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!