kbzpay
This commit is contained in:
@@ -9,6 +9,9 @@ class Api::Payment::CallbackController < Api::ApiController
|
|||||||
total_amount = params[:Request][:total_amount]
|
total_amount = params[:Request][:total_amount]
|
||||||
if trade_status == "PAY_SUCCESS"
|
if trade_status == "PAY_SUCCESS"
|
||||||
merch_order_id = params[:Request][:merch_order_id]
|
merch_order_id = params[:Request][:merch_order_id]
|
||||||
|
|
||||||
|
status, filename, sale_receipt_no, printer_name = Payment.pay(getCloudDomain, cash, sale_id, member_info, type, tax_type, path, latest_order_no, shop_detail, current_user, 'kbzpay', merch_order_id)
|
||||||
|
render json: JSON.generate({:status => status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -105,14 +105,17 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
#TODO :: KBZPAY ( QR )
|
#TODO :: KBZPAY ( QR )
|
||||||
# On/Off setting ( show or not qr )
|
# On/Off setting ( show or not qr )
|
||||||
# qrCode = "00020101021202021110500346KBZ005ab0ed5c1ed09d1c4585ff1313170389160831435294600062000040732kp1e78f7efddca190042638341afb88d50200006KBZPay0106KBZPay5303MMK5802MM62170813PAY_BY_QRCODE64060002my6304FBBD"
|
# qrCode = "00020101021202021110500346KBZ005ab0ed5c1ed09d1c4585ff1313170389160831435294600062000040732kp1e78f7efddca190042638341afb88d50200006KBZPay0106KBZPay5303MMK5802MM62170813PAY_BY_QRCODE64060002my6304FBBD"
|
||||||
kbz_pay_setting = PaymentMethodSetting.where(:payment_method => 'KBZPay').last
|
kbz_pay_setting = PaymentMethodSetting.where(:payment_method => KbzPay::KBZ_PAY).last
|
||||||
|
|
||||||
status = false
|
status = false
|
||||||
qr = nil
|
qr = nil
|
||||||
|
|
||||||
if !kbz_pay_setting.nil?
|
if !kbz_pay_setting.nil?
|
||||||
if kbz_pay_setting.is_active == true
|
if kbz_pay_setting.is_active == true
|
||||||
status, qr = KbzPay.pay(sale_data.grand_total, sale_data.receipt_no)
|
sale_payment = SalePayment.new
|
||||||
|
sale_payment.process_kbz_payment(sale_id, sale_data.grand_total, 0, 'pending')
|
||||||
|
|
||||||
|
status, qr = KbzPay.pay(sale_data.grand_total, sale_payment.sale_payment_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -124,6 +127,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
:printer_url => print_settings.api_settings
|
:printer_url => print_settings.api_settings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# status, qr = KbzPay.query(sale_payment.sale_payment_id)
|
||||||
|
|
||||||
# Mobile Print
|
# Mobile Print
|
||||||
render :json => result.to_json
|
render :json => result.to_json
|
||||||
# end
|
# end
|
||||||
@@ -137,6 +142,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
tax_type = params[:tax_type]
|
tax_type = params[:tax_type]
|
||||||
path = request.fullpath
|
path = request.fullpath
|
||||||
latest_order_no = nil
|
latest_order_no = nil
|
||||||
|
is_kbz = params[:is_kbz]
|
||||||
|
|
||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
@@ -158,13 +164,23 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
#end rounding adjustment
|
#end rounding adjustment
|
||||||
|
|
||||||
sale_payment = SalePayment.new
|
# if pay_from = 'kbzpay'
|
||||||
if path.include? ("credit_payment")
|
# salePayment = SalePayment.find(sale_payment_id)
|
||||||
sale_payment.process_payment(saleObj, current_user, cash, "cash", nil, true)
|
# salePayment.process_kbz_payment(salePayment.sale_id, sale_data.grand_total, cash, 'paid')
|
||||||
else
|
# else
|
||||||
sale_payment.process_payment(saleObj, current_user, cash, "cash")
|
# sp = SalePayment.where('sale_id=? and payment_method=? and payment_status=?', sale_id, 'kbzpay', 'paid').last
|
||||||
|
if sp.nil? #is_kbz
|
||||||
|
Rails.logger.info '################ CASH PAYMENT #################'
|
||||||
|
sale_payment = SalePayment.new
|
||||||
|
if path.include? ("credit_payment")
|
||||||
|
sale_payment.process_payment(saleObj, current_user, cash, "cash", nil, true)
|
||||||
|
else
|
||||||
|
sale_payment.process_payment(saleObj, current_user, cash, "cash")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# end
|
||||||
|
|
||||||
if !path.include? ("credit_payment")
|
if !path.include? ("credit_payment")
|
||||||
rebate_amount = nil
|
rebate_amount = nil
|
||||||
|
|
||||||
@@ -233,7 +249,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
#orders print out
|
#orders print out
|
||||||
if params[:type] == "quick_service"
|
if type == "quick_service"
|
||||||
booking = Booking.find_by_sale_id(sale_id)
|
booking = Booking.find_by_sale_id(sale_id)
|
||||||
if booking.dining_facility_id.to_i>0
|
if booking.dining_facility_id.to_i>0
|
||||||
table_id = booking.dining_facility_id
|
table_id = booking.dining_facility_id
|
||||||
@@ -284,13 +300,22 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Paid",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil)
|
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Paid",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil)
|
||||||
|
|
||||||
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
|
|
||||||
|
|
||||||
#end
|
#end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# status, filename, sale_receipt_no, printer_name = Payment.pay(getCloudDomain, cash, sale_id, member_info, type, tax_type, path, latest_order_no, shop_detail, current_user, nil, nil)
|
||||||
|
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# def kbz_query
|
||||||
|
# sale_id = params[:sale_id]
|
||||||
|
# table_id = params[:table_id]
|
||||||
|
# sp = SalePayment.where('sale_id=?', sale_id).last
|
||||||
|
# status, table_id = KbzPay.query(sp.sale_payment_id)
|
||||||
|
# render json: JSON.generate({:status => status, :table_id => table_id, :message => @message})
|
||||||
|
# end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
display_type = Lookup.find_by_lookup_type("display_type")
|
display_type = Lookup.find_by_lookup_type("display_type")
|
||||||
if !display_type.nil? && display_type.value.to_i ==2
|
if !display_type.nil? && display_type.value.to_i ==2
|
||||||
@@ -317,6 +342,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
if Sale.exists?(sale_id)
|
if Sale.exists?(sale_id)
|
||||||
@cash = 0.0
|
@cash = 0.0
|
||||||
|
@kbz_pay_amount = 0.0
|
||||||
@other = 0.0
|
@other = 0.0
|
||||||
@ppamount = 0.0
|
@ppamount = 0.0
|
||||||
@visacount= 0.0
|
@visacount= 0.0
|
||||||
@@ -341,6 +367,9 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
@pdf_view = @lookup_pdf.value
|
@pdf_view = @lookup_pdf.value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
amount = SalePayment.get_kbz_pay_amount(sale_id, current_user)
|
||||||
|
@kbz_pay_amount += amount.to_f
|
||||||
|
|
||||||
#for changable on/off
|
#for changable on/off
|
||||||
@changable_tax = true
|
@changable_tax = true
|
||||||
lookup_changable_tax = Lookup.collection_of('changable_tax')
|
lookup_changable_tax = Lookup.collection_of('changable_tax')
|
||||||
@@ -463,39 +492,40 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
else
|
else
|
||||||
@sale_payment_data = SalePayment.get_sale_payments(@sale_data)
|
@sale_payment_data = SalePayment.get_sale_payments(@sale_data)
|
||||||
end
|
end
|
||||||
@sale_payment_data.each do |spay|
|
@sale_payment_data.each do |spay|
|
||||||
if spay.payment_method == "cash"
|
if spay.payment_method == "cash"
|
||||||
@cash += spay.payment_amount
|
@cash += spay.payment_amount
|
||||||
end
|
end
|
||||||
if spay.payment_method !="creditnote"
|
if spay.payment_method !="creditnote"
|
||||||
@other_payment += spay.payment_amount
|
@other_payment += spay.payment_amount
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if spay.payment_method == "mpu"
|
||||||
|
@other += spay.payment_amount
|
||||||
|
elsif spay.payment_method == "paypar"
|
||||||
|
@ppamount += spay.payment_amount
|
||||||
|
elsif spay.payment_method == "visa"
|
||||||
|
@visacount += spay.payment_amount
|
||||||
|
elsif spay.payment_method == "jcb"
|
||||||
|
@jcbcount += spay.payment_amount
|
||||||
|
elsif spay.payment_method == "master"
|
||||||
|
@mastercount += spay.payment_amount
|
||||||
|
elsif spay.payment_method == "unionpay"
|
||||||
|
@unionpaycount += spay.payment_amount
|
||||||
|
elsif spay.payment_method == "JunctionPay"
|
||||||
|
@junctionpaycount += spay.payment_amount
|
||||||
|
elsif spay.payment_method == "creditnote"
|
||||||
|
@credit += spay.payment_amount
|
||||||
|
elsif spay.payment_method == "paymal"
|
||||||
|
@paymalcount += spay.payment_amount
|
||||||
|
elsif spay.payment_method == "alipay"
|
||||||
|
@alipaycount += spay.payment_amount
|
||||||
|
elsif spay.payment_method == "dinga"
|
||||||
|
@dingacount += spay.payment_amount
|
||||||
|
elsif spay.payment_method == "giftvoucher"
|
||||||
|
@giftvouchercount += spay.payment_amount
|
||||||
|
end
|
||||||
|
|
||||||
if spay.payment_method == "mpu"
|
|
||||||
@other += spay.payment_amount
|
|
||||||
elsif spay.payment_method == "paypar"
|
|
||||||
@ppamount += spay.payment_amount
|
|
||||||
elsif spay.payment_method == "visa"
|
|
||||||
@visacount += spay.payment_amount
|
|
||||||
elsif spay.payment_method == "jcb"
|
|
||||||
@jcbcount += spay.payment_amount
|
|
||||||
elsif spay.payment_method == "master"
|
|
||||||
@mastercount += spay.payment_amount
|
|
||||||
elsif spay.payment_method == "unionpay"
|
|
||||||
@unionpaycount += spay.payment_amount
|
|
||||||
elsif spay.payment_method == "JunctionPay"
|
|
||||||
@junctionpaycount += spay.payment_amount
|
|
||||||
elsif spay.payment_method == "creditnote"
|
|
||||||
@credit += spay.payment_amount
|
|
||||||
elsif spay.payment_method == "paymal"
|
|
||||||
@paymalcount += spay.payment_amount
|
|
||||||
elsif spay.payment_method == "alipay"
|
|
||||||
@alipaycount += spay.payment_amount
|
|
||||||
elsif spay.payment_method == "dinga"
|
|
||||||
@dingacount += spay.payment_amount
|
|
||||||
elsif spay.payment_method == "giftvoucher"
|
|
||||||
@giftvouchercount += spay.payment_amount
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class Origami::TableInvoicesController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
puts 'Catch me if you can.......................'
|
# puts 'Catch me if you can.......................'
|
||||||
@table = DiningFacility.find(params[:table_id])
|
@table = DiningFacility.find(params[:table_id])
|
||||||
@membership = MembershipSetting::MembershipSetting
|
@membership = MembershipSetting::MembershipSetting
|
||||||
@payment_methods = PaymentMethodSetting.all
|
@payment_methods = PaymentMethodSetting.all
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class Reports::PaymentMethodController < BaseReportController
|
|||||||
# authorize_resource :class => false
|
# authorize_resource :class => false
|
||||||
def index
|
def index
|
||||||
|
|
||||||
@payments = [["All Payment",''],["Cash Payment","cash"], ["Credit Payment","creditnote"],
|
@payments = [["All Payment",''],["Cash Payment","cash"], ["KBZ Payment", KbzPay::KBZ_PAY], ["Credit Payment","creditnote"],
|
||||||
["FOC Payment","foc"], ["MPU Payment","mpu"], ["Visa Payment","visa"],
|
["FOC Payment","foc"], ["MPU Payment","mpu"], ["Visa Payment","visa"],
|
||||||
["Master Payment","master"], ["JCB Payment","jcb"],["UnionPay Payment","unionpay"],
|
["Master Payment","master"], ["JCB Payment","jcb"],["UnionPay Payment","unionpay"],
|
||||||
["Alipay Payment","alipay"],["Paymal Payment", "paymal"],["Dinga Payment","dinga"],
|
["Alipay Payment","alipay"],["Paymal Payment", "paymal"],["Dinga Payment","dinga"],
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
class KbzPay
|
class KbzPay
|
||||||
|
|
||||||
|
KBZ_PAY = 'KBZPay'
|
||||||
|
|
||||||
def self.pay(amount, receipt_no)
|
def self.pay(amount, receipt_no)
|
||||||
|
|
||||||
datetime = DateTime.now.strftime("%d%m%Y%H%M")
|
datetime = DateTime.now.strftime("%d%m%Y%H%M")
|
||||||
@@ -14,26 +16,28 @@ class KbzPay
|
|||||||
kbz_callback_url = "https://staging-v2.doemal.com/api/v3/ordering/kbz_callback"
|
kbz_callback_url = "https://staging-v2.doemal.com/api/v3/ordering/kbz_callback"
|
||||||
nounce_str = SecureRandom.base64(32).first(32).upcase
|
nounce_str = SecureRandom.base64(32).first(32).upcase
|
||||||
|
|
||||||
params = "appid="+kbz_app_id+"&merch_code="+kbz_merch_code+"&merch_order_id="+receipt_no.to_s+"&method="+kbz_method+"&nonce_str="+nounce_str.to_s+"¬ify_url="+ kbz_callback_url + "×tamp="+datetime+"&total_amount="+amount.to_s+"&trade_type="+kbz_trade_type+"&trans_currency="+ kbz_currency+"&version="+kbz_version+"&key="+kbz_api_key
|
params = "appid="+kbz_app_id+"&merch_code="+kbz_merch_code+"&merch_order_id="+receipt_no.to_s+"&method="+kbz_method+"&nonce_str="+nounce_str.to_s+"¬ify_url="+ kbz_callback_url + "&timeout_express=20m×tamp="+datetime+"&total_amount="+amount.to_s+"&trade_type="+kbz_trade_type+"&trans_currency="+ kbz_currency+"&version="+kbz_version+"&key="+kbz_api_key
|
||||||
|
|
||||||
Rails.logger.info params
|
Rails.logger.info params
|
||||||
sign = Digest::SHA256.hexdigest(params)
|
sign = Digest::SHA256.hexdigest(params)
|
||||||
str = {"timestamp": datetime,
|
str = {
|
||||||
"method": kbz_method,
|
"timestamp": datetime,
|
||||||
"notify_url": kbz_callback_url,
|
"method": kbz_method,
|
||||||
"nonce_str": nounce_str.to_s,
|
"notify_url": kbz_callback_url,
|
||||||
"sign_type": "SHA256",
|
"nonce_str": nounce_str.to_s,
|
||||||
"sign": sign,
|
"sign_type": "SHA256",
|
||||||
"version": kbz_version,
|
"sign": sign,
|
||||||
"biz_content": {
|
"version": kbz_version,
|
||||||
"merch_order_id": receipt_no,
|
"biz_content": {
|
||||||
"merch_code": kbz_merch_code,
|
"merch_order_id": receipt_no,
|
||||||
"appid": kbz_app_id,
|
"merch_code": kbz_merch_code,
|
||||||
"trade_type": kbz_trade_type,
|
"appid": kbz_app_id,
|
||||||
"total_amount": amount.to_s,
|
"trade_type": kbz_trade_type,
|
||||||
"trans_currency": kbz_currency
|
"total_amount": amount.to_s,
|
||||||
}
|
"timeout_express": "20m",
|
||||||
}
|
"trans_currency": kbz_currency
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
result = HTTParty.post(kbz_provider_url,
|
result = HTTParty.post(kbz_provider_url,
|
||||||
:body => { :Request => str}.to_json,
|
:body => { :Request => str}.to_json,
|
||||||
@@ -51,4 +55,71 @@ class KbzPay
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.query(receipt_no, current_user)
|
||||||
|
amount = 0
|
||||||
|
datetime = DateTime.now.strftime("%d%m%Y%H%M")
|
||||||
|
kbz_app_id = "kp1e78f7efddca190042638341afb88d"
|
||||||
|
kbz_merch_code = "200004"
|
||||||
|
kbz_method = 'kbz.payment.queryorder'
|
||||||
|
kbz_trade_type = "APP"
|
||||||
|
kbz_api_key = "code2lab123456"
|
||||||
|
kbz_version = "1.0"
|
||||||
|
kbz_provider_url = "http://api.kbzpay.com/payment/gateway/uat/queryorder"
|
||||||
|
kbz_currency = "MMK"
|
||||||
|
kbz_callback_url = "https://staging-v2.doemal.com/api/v3/ordering/kbz_callback"
|
||||||
|
nounce_str = SecureRandom.base64(32).first(32).upcase
|
||||||
|
|
||||||
|
params = "appid="+kbz_app_id+"&merch_code="+kbz_merch_code+"&merch_order_id="+receipt_no.to_s+"&method="+kbz_method+"&nonce_str="+nounce_str.to_s+"×tamp="+datetime+"&version="+kbz_version+"&key="+kbz_api_key
|
||||||
|
|
||||||
|
Rails.logger.info params
|
||||||
|
sign = Digest::SHA256.hexdigest(params)
|
||||||
|
str = {"timestamp": datetime,
|
||||||
|
"method": kbz_method,
|
||||||
|
"nonce_str": nounce_str.to_s,
|
||||||
|
"sign_type": "SHA256",
|
||||||
|
"sign": sign,
|
||||||
|
"version": kbz_version,
|
||||||
|
"biz_content": {
|
||||||
|
"merch_order_id": receipt_no,
|
||||||
|
"merch_code": kbz_merch_code,
|
||||||
|
"appid": kbz_app_id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
result = HTTParty.post(kbz_provider_url,
|
||||||
|
:body => { :Request => str}.to_json,
|
||||||
|
:headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json' }
|
||||||
|
)
|
||||||
|
Rails.logger.info result
|
||||||
|
Rails.logger.info "........................."
|
||||||
|
if result['Response']['result'] == "SUCCESS"
|
||||||
|
if result['Response']['trade_status'] == "PAY_SUCCESS"
|
||||||
|
merch_order_id = result['Response']['merch_order_id']
|
||||||
|
cash = result['Response']['total_amount']
|
||||||
|
|
||||||
|
sp = SalePayment.find(merch_order_id)
|
||||||
|
if !sp.nil?
|
||||||
|
if sp.payment_status == 'pending'
|
||||||
|
saleObj = Sale.find(sp.sale_id)
|
||||||
|
if sp.process_payment(saleObj, current_user, cash, KbzPay::KBZ_PAY)
|
||||||
|
amount = cash
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# return true, "successfully paid by KBZ PAY"
|
||||||
|
elsif result['Response']['trade_status'] == "PAY_FAILED"
|
||||||
|
|
||||||
|
# return false, "pay failed by KBZ PAY"
|
||||||
|
elsif result['Response']['trade_status'] == "WAIT_PAY"
|
||||||
|
# return false , "Waiting to pay by KBZ PAY"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
#FAIL result
|
||||||
|
# return false, "pay by KBZ PAY has failed"
|
||||||
|
end
|
||||||
|
|
||||||
|
return amount
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
6
app/models/payment.rb
Normal file
6
app/models/payment.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
class Payment
|
||||||
|
|
||||||
|
# def self.pay(getCloudDomain, cash, sale_id, member_info, type, tax_type, path, latest_order_no, shop_detail, current_user, pay_from, sale_payment_id)
|
||||||
|
|
||||||
|
# end
|
||||||
|
end
|
||||||
@@ -921,6 +921,7 @@ def self.daily_sales_list(from,to)
|
|||||||
AND DATE_FORMAT(CONVERT_TZ(s.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') = DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d')"
|
AND DATE_FORMAT(CONVERT_TZ(s.receipt_date,'+00:00','+06:30'),'%Y-%m-%d') = DATE_FORMAT(CONVERT_TZ(sales.receipt_date,'+00:00','+06:30'),'%Y-%m-%d')"
|
||||||
|
|
||||||
payments_total = Sale.select("CAST((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')) AS DATE) as sale_date,
|
payments_total = Sale.select("CAST((CONVERT_TZ(sales.receipt_date,'+00:00','+06:30')) AS DATE) as sale_date,
|
||||||
|
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='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
|
SUM(case when (sale_payments.payment_method='mpu') then sale_payments.payment_amount else 0 end) as mpu_amount,
|
||||||
SUM(case when (sale_payments.payment_method='master') then sale_payments.payment_amount else 0 end) as master_amount,
|
SUM(case when (sale_payments.payment_method='master') then sale_payments.payment_amount else 0 end) as master_amount,
|
||||||
SUM(case when (sale_payments.payment_method='visa') then sale_payments.payment_amount else 0 end) as visa_amount,
|
SUM(case when (sale_payments.payment_method='visa') then sale_payments.payment_amount else 0 end) as visa_amount,
|
||||||
@@ -970,6 +971,7 @@ def self.daily_sales_list(from,to)
|
|||||||
:paypar_amount => pay.paypar_amount,
|
:paypar_amount => pay.paypar_amount,
|
||||||
:unionpay_amount => pay.unionpay_amount,
|
:unionpay_amount => pay.unionpay_amount,
|
||||||
:alipay_amount => pay.alipay_amount,
|
:alipay_amount => pay.alipay_amount,
|
||||||
|
:kbzpay_amount => pay.kbzpay_amount,
|
||||||
:paymal_amount => pay.paymal_amount,
|
:paymal_amount => pay.paymal_amount,
|
||||||
:dinga_amount => pay.dinga_amount,
|
:dinga_amount => pay.dinga_amount,
|
||||||
:junctionpay_amount => pay.junctionpay_amount,
|
:junctionpay_amount => pay.junctionpay_amount,
|
||||||
@@ -1453,6 +1455,7 @@ def self.get_payment_method_by_shift(shift_sale_range,shift,from,to,payment_type
|
|||||||
SUM(case when (sale_payments.payment_method='paypar') then sale_payments.payment_amount else 0 end) as paypar_amount,
|
SUM(case when (sale_payments.payment_method='paypar') then sale_payments.payment_amount else 0 end) as paypar_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='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='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='paymal') then sale_payments.payment_amount else 0 end) as paymal_amount,
|
SUM(case when (sale_payments.payment_method='paymal') then sale_payments.payment_amount else 0 end) as paymal_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='dinga') then sale_payments.payment_amount else 0 end) as dinga_amount,
|
||||||
SUM(case when (sale_payments.payment_method='JunctionPay') then sale_payments.payment_amount else 0 end) as junctionpay_amount,
|
SUM(case when (sale_payments.payment_method='JunctionPay') then sale_payments.payment_amount else 0 end) as junctionpay_amount,
|
||||||
|
|||||||
@@ -29,6 +29,37 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.get_kbz_pay_amount(sale_id, current_user)
|
||||||
|
amount = 0
|
||||||
|
sale_payment = SalePayment.where('sale_id=? and payment_status!=?', sale_id, 'dead').last
|
||||||
|
if !sale_payment.nil?
|
||||||
|
if sale_payment.payment_status == 'pending'
|
||||||
|
amount = KbzPay.query(sale_payment.id, current_user)
|
||||||
|
elsif sale_payment.payment_status == 'paid'
|
||||||
|
amount = sale_payment.payment_amount
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return amount
|
||||||
|
end
|
||||||
|
|
||||||
|
def process_kbz_payment(sale_id, grand_total, pay_amount, status)
|
||||||
|
if status == 'pending'
|
||||||
|
SalePayment.where("sale_id=? and payment_method=? and payment_status=?", sale_id, KbzPay::KBZ_PAY, 'pending').update_all(:payment_status => 'dead')
|
||||||
|
end
|
||||||
|
|
||||||
|
self.sale_id = sale_id
|
||||||
|
self.payment_method = KbzPay::KBZ_PAY
|
||||||
|
self.payment_amount = self.payment_amount.to_i + pay_amount.to_i
|
||||||
|
if grand_total > 0
|
||||||
|
self.outstanding_amount = grand_total.to_i - pay_amount.to_i
|
||||||
|
else
|
||||||
|
self.outstanding_amount = self.outstanding_amount.to_i - pay_amount.to_i
|
||||||
|
end
|
||||||
|
self.payment_status = status
|
||||||
|
return self.save
|
||||||
|
end
|
||||||
|
|
||||||
def process_payment(invoice, action_by, cash_amount, payment_method,remark=nil,payment_for=false)
|
def process_payment(invoice, action_by, cash_amount, payment_method,remark=nil,payment_for=false)
|
||||||
self.sale = invoice
|
self.sale = invoice
|
||||||
self.received_amount = cash_amount
|
self.received_amount = cash_amount
|
||||||
@@ -90,8 +121,8 @@ class SalePayment < ApplicationRecord
|
|||||||
payment_status,membership_data = dinga_payment
|
payment_status,membership_data = dinga_payment
|
||||||
when "GiftVoucher"
|
when "GiftVoucher"
|
||||||
payment_status = giftvoucher_payment
|
payment_status = giftvoucher_payment
|
||||||
when "KbzPay"
|
when KbzPay::KBZ_PAY
|
||||||
payment_status = giftvoucher_payment
|
payment_status = kbz_payment
|
||||||
else
|
else
|
||||||
puts "it was something else"
|
puts "it was something else"
|
||||||
end
|
end
|
||||||
@@ -346,6 +377,7 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
payment_status = false
|
payment_status = false
|
||||||
|
|
||||||
self.payment_method = "cash"
|
self.payment_method = "cash"
|
||||||
self.payment_amount = self.received_amount
|
self.payment_amount = self.received_amount
|
||||||
if !payment_for
|
if !payment_for
|
||||||
@@ -354,8 +386,10 @@ class SalePayment < ApplicationRecord
|
|||||||
credit_sale_payment = SalePayment.get_credit_total_left(self.sale_id)[0] ? SalePayment.get_credit_total_left(self.sale_id)[0].payment_amount.to_f : 0 ###need to calculate creditnote total in here
|
credit_sale_payment = SalePayment.get_credit_total_left(self.sale_id)[0] ? SalePayment.get_credit_total_left(self.sale_id)[0].payment_amount.to_f : 0 ###need to calculate creditnote total in here
|
||||||
self.outstanding_amount = credit_sale_payment - self.received_amount.to_f
|
self.outstanding_amount = credit_sale_payment - self.received_amount.to_f
|
||||||
end
|
end
|
||||||
|
|
||||||
self.payment_status = "paid"
|
self.payment_status = "paid"
|
||||||
payment_status = self.save!
|
payment_status = self.save!
|
||||||
|
|
||||||
if !payment_for
|
if !payment_for
|
||||||
sale_update_payment_status(self.received_amount,status)
|
sale_update_payment_status(self.received_amount,status)
|
||||||
end
|
end
|
||||||
@@ -586,11 +620,13 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
def kbz_payment
|
def kbz_payment
|
||||||
payment_status = false
|
payment_status = false
|
||||||
status, response = KbzPay.pay(amount, receipt_no)
|
self.payment_amount = self.received_amount
|
||||||
if status
|
self.payment_reference = self.payment_reference
|
||||||
payment_status = true
|
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
||||||
return
|
self.payment_status = "paid"
|
||||||
end
|
payment_status = self.save!
|
||||||
|
sale_update_payment_status(self.received_amount)
|
||||||
|
return payment_status
|
||||||
end
|
end
|
||||||
|
|
||||||
def sale_update_payment_status(paid_amount,check_foc = false)
|
def sale_update_payment_status(paid_amount,check_foc = false)
|
||||||
@@ -602,6 +638,7 @@ class SalePayment < ApplicationRecord
|
|||||||
sObj = Sale.find(self.sale_id)
|
sObj = Sale.find(self.sale_id)
|
||||||
is_credit = 0
|
is_credit = 0
|
||||||
is_foc = 0
|
is_foc = 0
|
||||||
|
is_kbz_pay = 0
|
||||||
method_status = false
|
method_status = false
|
||||||
sObj.sale_payments.each do |spay|
|
sObj.sale_payments.each do |spay|
|
||||||
all_received_amount += spay.payment_amount.to_f
|
all_received_amount += spay.payment_amount.to_f
|
||||||
@@ -611,7 +648,10 @@ class SalePayment < ApplicationRecord
|
|||||||
if spay.payment_method == "foc"
|
if spay.payment_method == "foc"
|
||||||
is_foc = 1
|
is_foc = 1
|
||||||
end
|
end
|
||||||
if spay.payment_method == "cash" || spay.payment_method == "foc" || spay.payment_method == "creditnote"
|
if spay.payment_method == KbzPay::KBZ_PAY
|
||||||
|
is_kbz_pay = 1
|
||||||
|
end
|
||||||
|
if spay.payment_method == "cash" || spay.payment_method == "foc" || spay.payment_method == "creditnote" || spay.payment_method == 'kbzpay'
|
||||||
method_status = true
|
method_status = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -629,6 +669,10 @@ class SalePayment < ApplicationRecord
|
|||||||
self.sale.payment_status = "foc"
|
self.sale.payment_status = "foc"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if is_kbz_pay > 0
|
||||||
|
self.sale.payment_status = 'paid'
|
||||||
|
end
|
||||||
|
|
||||||
self.sale.sale_status = "completed"
|
self.sale.sale_status = "completed"
|
||||||
|
|
||||||
if MembershipSetting.find_by_rebate(1) && is_foc == 0 && is_credit == 0
|
if MembershipSetting.find_by_rebate(1) && is_foc == 0 && is_credit == 0
|
||||||
|
|||||||
@@ -689,9 +689,9 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
if status == 'Frt'
|
if status == 'Frt'
|
||||||
move_down line_move
|
move_down line_move
|
||||||
move_down line_move
|
move_down line_move
|
||||||
text "KBZ Pay", :size => self.header_font_size+2, :align => :center
|
text "Scan to pay with KBZ Pay", :size => self.header_font_size, :align => :center
|
||||||
move_down line_move
|
move_down line_move
|
||||||
print_qr_code(qr_code, pos: [30, cursor], extent: 160, stroke: false, dot: 1000)
|
print_qr_code(qr_code, pos: [39, cursor], extent: 161, stroke: false, dot: 1000)
|
||||||
# stroke_horizontal_rule
|
# stroke_horizontal_rule
|
||||||
move_down line_move
|
move_down line_move
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -540,6 +540,8 @@
|
|||||||
|
|
||||||
<button type="button" id="pay" data-order="<%= existing_order %>" class="btn btn-block bg-blue waves-effect">Pay</button>
|
<button type="button" id="pay" data-order="<%= existing_order %>" class="btn btn-block bg-blue waves-effect">Pay</button>
|
||||||
|
|
||||||
|
<!-- <button type="button" id="kbz_query" data-order="<%= existing_order %>" class="btn btn-block bg-blue waves-effect">KBZ Query</button> -->
|
||||||
|
|
||||||
<!--<% if current_login_employee.role != "waiter" %>
|
<!--<% if current_login_employee.role != "waiter" %>
|
||||||
<button type="button" class="btn action-btn bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button>
|
<button type="button" class="btn action-btn bg-blue waves-effect" data-toggle="modal" data-target="#waste_spoileModal" > Waste & Spoile</button>
|
||||||
<% end %>-->
|
<% end %>-->
|
||||||
@@ -1072,6 +1074,24 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// $('#kbz_query').on('click', function(){
|
||||||
|
// var sale_id = $('#sale_id').val();
|
||||||
|
// var dining_id = "<%= @dining.id %>";
|
||||||
|
// // window.location.href = '/origami/payment/kbz_query/'+ sale_id;
|
||||||
|
// $.ajax({
|
||||||
|
// type: 'POST',
|
||||||
|
// data: 'table_id='+dining_id,
|
||||||
|
// url: '/origami/payment/kbz_query/'+sale_id,
|
||||||
|
// success: function(result){
|
||||||
|
// if (result.status == true) {
|
||||||
|
// window.location.href = '/origami';
|
||||||
|
// }else{
|
||||||
|
// location.reload()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// })
|
||||||
|
|
||||||
// Bill Request
|
// Bill Request
|
||||||
$('#request_bills').click(function () {
|
$('#request_bills').click(function () {
|
||||||
var order_id = $('#save_order_id').attr('data-order');
|
var order_id = $('#save_order_id').attr('data-order');
|
||||||
|
|||||||
@@ -201,7 +201,14 @@
|
|||||||
<% else %>
|
<% else %>
|
||||||
<div class="col-md-4 hidden" id="credit">0</div>
|
<div class="col-md-4 hidden" id="credit">0</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0 && @unionpaycount == 0.0 && @alipaycount == 0.0 && @paymalcount == 0.0 && @junctionpaycount == 0.0 && @dingacount == 0.0 && @giftvouchercount == 0.0 %>
|
<% if @kbz_pay_amount > 0.0 %>
|
||||||
|
<div class="row payment other-payment-color" id="card_payment" >
|
||||||
|
<div class="col-md-8">Other Payments (KBZ Pay)</div>
|
||||||
|
<div class="col-md-4" id="others">
|
||||||
|
<%= number_with_precision(@kbz_pay_amount, precision: precision.to_i) rescue number_with_precision(0, precision: precision.to_i) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% elsif @other == 0.0 && @ppamount == 0.0 && @visacount == 0.0 && @jcbcount == 0.0 && @mastercount == 0.0 && @unionpaycount == 0.0 && @alipaycount == 0.0 && @paymalcount == 0.0 && @junctionpaycount == 0.0 && @dingacount == 0.0 && @giftvouchercount == 0.0 %>
|
||||||
<div class="row payment other-payment-color" id="card_payment" >
|
<div class="row payment other-payment-color" id="card_payment" >
|
||||||
<div class="col-md-8">Other Payments</div>
|
<div class="col-md-8">Other Payments</div>
|
||||||
<div class="col-md-4" id="others">
|
<div class="col-md-4" id="others">
|
||||||
@@ -400,6 +407,10 @@
|
|||||||
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
<button type="button" class="btn btn-block btn-default waves-effect" id='back'>
|
||||||
<i class="material-icons">reply</i>
|
<i class="material-icons">reply</i>
|
||||||
Back
|
Back
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-block btn-default waves-effect" id='refresh'>
|
||||||
|
<!-- <i class="material-icons">reply</i> -->
|
||||||
|
Refresh
|
||||||
</button>
|
</button>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<% if current_login_employee.role == "cashier" %>
|
<% if current_login_employee.role == "cashier" %>
|
||||||
@@ -782,6 +793,10 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#refresh").on('click', function(){
|
||||||
|
window.location.reload();
|
||||||
|
})
|
||||||
|
|
||||||
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){
|
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -867,6 +882,11 @@ $(document).ready(function(){
|
|||||||
var cash = $('#cash').text();
|
var cash = $('#cash').text();
|
||||||
var credit = $('#credit').text();
|
var credit = $('#credit').text();
|
||||||
var card = $('#card').text();
|
var card = $('#card').text();
|
||||||
|
var kbz_amt = "<%= @kbz_pay_amount %>";
|
||||||
|
var is_kbz = false;
|
||||||
|
if (kbz_amt > 0) {
|
||||||
|
is_kbz = true
|
||||||
|
}
|
||||||
|
|
||||||
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
|
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
|
||||||
if (credit <= 0 && (!location.pathname.includes("credit_payment"))) {
|
if (credit <= 0 && (!location.pathname.includes("credit_payment"))) {
|
||||||
@@ -884,7 +904,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: url,
|
url: url,
|
||||||
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type,
|
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type + "&is_kbz=" + is_kbz,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
/* start delete receipt no in first bill*/
|
/* start delete receipt no in first bill*/
|
||||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||||
|
|||||||
@@ -45,6 +45,9 @@
|
|||||||
<% if @payment_methods.include? ("UNIONPAY") %>
|
<% if @payment_methods.include? ("UNIONPAY") %>
|
||||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.unionpay_sales") %></th>
|
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.unionpay_sales") %></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if @payment_methods.include? ("KBZPay") %>
|
||||||
|
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.kbzpay_sales") %></th>
|
||||||
|
<% end %>
|
||||||
<% if @payment_methods.include? ("Alipay") %>
|
<% if @payment_methods.include? ("Alipay") %>
|
||||||
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.alipay_sales") %></th>
|
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.alipay_sales") %></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -104,6 +107,7 @@
|
|||||||
<% credit = 0 %>
|
<% credit = 0 %>
|
||||||
<% foc = 0 %>
|
<% foc = 0 %>
|
||||||
<% discount = 0 %>
|
<% discount = 0 %>
|
||||||
|
<% kbzpay = 0 %>
|
||||||
<% total = 0 %>
|
<% total = 0 %>
|
||||||
<% grand_total = 0 %>
|
<% grand_total = 0 %>
|
||||||
<% old_grand_total = 0 %>
|
<% old_grand_total = 0 %>
|
||||||
@@ -125,6 +129,7 @@
|
|||||||
<% credit += sale[:credit_amount] %>
|
<% credit += sale[:credit_amount] %>
|
||||||
<% foc += sale[:foc_amount] %>
|
<% foc += sale[:foc_amount] %>
|
||||||
<% discount += sale[:total_discount] %>
|
<% discount += sale[:total_discount] %>
|
||||||
|
<% kbzpay += sale[:kbzpay_amount] %>
|
||||||
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
|
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
|
||||||
<% grand_total += sale[:grand_total].to_f %>
|
<% grand_total += sale[:grand_total].to_f %>
|
||||||
<% old_grand_total += sale[:old_grand_total].to_f %>
|
<% old_grand_total += sale[:old_grand_total].to_f %>
|
||||||
@@ -151,6 +156,9 @@
|
|||||||
<% if @payment_methods.include? ("Alipay") %>
|
<% if @payment_methods.include? ("Alipay") %>
|
||||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:alipay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:alipay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if @payment_methods.include? ("KBZPay") %>
|
||||||
|
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:kbzpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<% end %>
|
||||||
<% if @payment_methods.include? ("PAYMAL") %>
|
<% if @payment_methods.include? ("PAYMAL") %>
|
||||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:paymal_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:paymal_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -216,6 +224,12 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(alipay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(alipay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if @payment_methods.include? ("KBZPay") %>
|
||||||
|
<% if !request.user_agent.include? "Mobile" %>
|
||||||
|
<% colspan += 1 %>
|
||||||
|
<% end %>
|
||||||
|
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(kbzpay, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<% end %>
|
||||||
<% if @payment_methods.include? ("PAYMAL") %>
|
<% if @payment_methods.include? ("PAYMAL") %>
|
||||||
<% if !request.user_agent.include? "Mobile" %>
|
<% if !request.user_agent.include? "Mobile" %>
|
||||||
<% colspan += 1 %>
|
<% colspan += 1 %>
|
||||||
|
|||||||
@@ -33,6 +33,9 @@
|
|||||||
<% if @payment_methods.include? ("UNIONPAY") %>
|
<% if @payment_methods.include? ("UNIONPAY") %>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.unionpay_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.unionpay_sales") %></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if @payment_methods.include? ("KBZPay") %>
|
||||||
|
<th style='text-align:center;' class="d-none d-sm-table-cell"><%= t("views.right_panel.detail.kbzpay_sales") %></th>
|
||||||
|
<% end %>
|
||||||
<% if @payment_methods.include? ("Alipay") %>
|
<% if @payment_methods.include? ("Alipay") %>
|
||||||
<th style='text-align:center;'><%= t("views.right_panel.detail.alipay_sales") %></th>
|
<th style='text-align:center;'><%= t("views.right_panel.detail.alipay_sales") %></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -92,6 +95,7 @@
|
|||||||
<% credit = 0 %>
|
<% credit = 0 %>
|
||||||
<% foc = 0 %>
|
<% foc = 0 %>
|
||||||
<% discount = 0 %>
|
<% discount = 0 %>
|
||||||
|
<% kbzpay = 0 %>
|
||||||
<% total = 0 %>
|
<% total = 0 %>
|
||||||
<% grand_total = 0 %>
|
<% grand_total = 0 %>
|
||||||
<% old_grand_total = 0 %>
|
<% old_grand_total = 0 %>
|
||||||
@@ -113,6 +117,7 @@
|
|||||||
<% credit += sale[:credit_amount] %>
|
<% credit += sale[:credit_amount] %>
|
||||||
<% foc += sale[:foc_amount] %>
|
<% foc += sale[:foc_amount] %>
|
||||||
<% discount += sale[:total_discount] %>
|
<% discount += sale[:total_discount] %>
|
||||||
|
<% kbzpay += sale[:kbzpay_amount] %>
|
||||||
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
|
<% total += sale[:grand_total].to_f + sale[:rounding_adj].to_f %>
|
||||||
<% grand_total += sale[:grand_total].to_f %>
|
<% grand_total += sale[:grand_total].to_f %>
|
||||||
<% old_grand_total += sale[:old_grand_total].to_f %>
|
<% old_grand_total += sale[:old_grand_total].to_f %>
|
||||||
@@ -139,6 +144,9 @@
|
|||||||
<% if @payment_methods.include? ("Alipay") %>
|
<% if @payment_methods.include? ("Alipay") %>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:alipay_amount]),delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:alipay_amount]),delimiter => ',') rescue '-'%></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if @payment_methods.include? ("KBZPay") %>
|
||||||
|
<td style='text-align:right;' class="d-none d-sm-table-cell"><%= number_with_precision(sale[:kbzpay_amount], precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||||
|
<% end %>
|
||||||
<% if @payment_methods.include? ("PAYMAL") %>
|
<% if @payment_methods.include? ("PAYMAL") %>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paymal_amount]),delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",sale[:paymal_amount]),delimiter => ',') rescue '-'%></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -192,6 +200,10 @@
|
|||||||
<% colspan += 1 %>
|
<% colspan += 1 %>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",alipay),delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",alipay),delimiter => ',') rescue '-'%></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if @payment_methods.include? ("KBZPay") %>
|
||||||
|
<% colspan += 1 %>
|
||||||
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",kbzpay),delimiter => ',') rescue '-'%></td>
|
||||||
|
<% end %>
|
||||||
<% if @payment_methods.include? ("PAYMAL") %>
|
<% if @payment_methods.include? ("PAYMAL") %>
|
||||||
<% colspan += 1 %>
|
<% colspan += 1 %>
|
||||||
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paymal),delimiter => ',') rescue '-'%></td>
|
<td style='text-align:right;'><%= number_with_delimiter(sprintf("%.2f",paymal),delimiter => ',') rescue '-'%></td>
|
||||||
|
|||||||
@@ -46,7 +46,8 @@
|
|||||||
<th><%= t("views.right_panel.detail.jcb_sales") %></th>
|
<th><%= t("views.right_panel.detail.jcb_sales") %></th>
|
||||||
<th><%= t("views.right_panel.detail.unionpay_sales") %></th>
|
<th><%= t("views.right_panel.detail.unionpay_sales") %></th>
|
||||||
<th><%= t("views.right_panel.detail.alipay_sales") %></th>
|
<th><%= t("views.right_panel.detail.alipay_sales") %></th>
|
||||||
<th><%= t("views.right_panel.detail.paymal_sales") %></th>
|
<th><%= t("views.right_panel.detail.kbzpay_sales") %></th>
|
||||||
|
<!-- <th><%= t("views.right_panel.detail.paymal_sales") %></th> -->
|
||||||
<th><%= t("views.right_panel.detail.dinga_sales") %></th>
|
<th><%= t("views.right_panel.detail.dinga_sales") %></th>
|
||||||
<th><%= t("views.right_panel.detail.junctionpay_sales") %></th>
|
<th><%= t("views.right_panel.detail.junctionpay_sales") %></th>
|
||||||
<th><%= t("views.right_panel.detail.redeem_sales") %></th>
|
<th><%= t("views.right_panel.detail.redeem_sales") %></th>
|
||||||
@@ -78,7 +79,8 @@
|
|||||||
<td><%= number_with_precision(sale[:jcb_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(sale[:jcb_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_precision(sale[:unionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(sale[:unionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_precision(sale[:alipay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(sale[:alipay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_precision(sale[:paymal_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(sale[:kbzpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
|
<!-- <td><%= number_with_precision(sale[:paymal_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td> -->
|
||||||
<td><%= number_with_precision(sale[:dinga_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(sale[:dinga_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_precision(sale[:junctionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(sale[:junctionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_precision(sale[:paypar_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(sale[:paypar_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
|
|||||||
@@ -33,7 +33,8 @@
|
|||||||
<th><%= t("views.right_panel.detail.jcb_sales") %></th>
|
<th><%= t("views.right_panel.detail.jcb_sales") %></th>
|
||||||
<th><%= t("views.right_panel.detail.unionpay_sales") %></th>
|
<th><%= t("views.right_panel.detail.unionpay_sales") %></th>
|
||||||
<th><%= t("views.right_panel.detail.alipay_sales") %></th>
|
<th><%= t("views.right_panel.detail.alipay_sales") %></th>
|
||||||
<th><%= t("views.right_panel.detail.paymal_sales") %></th>
|
<th><%= t("views.right_panel.detail.kbzpay_sales") %></th>
|
||||||
|
<!-- <th><%= t("views.right_panel.detail.paymal_sales") %></th> -->
|
||||||
<th><%= t("views.right_panel.detail.dinga_sales") %></th>
|
<th><%= t("views.right_panel.detail.dinga_sales") %></th>
|
||||||
<th><%= t("views.right_panel.detail.junctionpay_sales") %></th>
|
<th><%= t("views.right_panel.detail.junctionpay_sales") %></th>
|
||||||
<th><%= t("views.right_panel.detail.redeem_sales") %></th>
|
<th><%= t("views.right_panel.detail.redeem_sales") %></th>
|
||||||
@@ -65,7 +66,8 @@
|
|||||||
<td><%= number_with_precision(sale[:jcb_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(sale[:jcb_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_precision(sale[:unionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(sale[:unionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_precision(sale[:alipay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(sale[:alipay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_precision(sale[:paymal_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(sale[:kbzpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
|
<!-- <td><%= number_with_precision(sale[:paymal_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td> -->
|
||||||
<td><%= number_with_precision(sale[:dinga_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(sale[:dinga_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_precision(sale[:junctionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(sale[:junctionpay_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
<td><%= number_with_precision(sale[:paypar_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(sale[:paypar_amount], precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
|
|||||||
@@ -221,6 +221,7 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
|
|
||||||
post 'payment/:type/foc' => 'payments#foc', :defaults => {:format => 'json'}
|
post 'payment/:type/foc' => 'payments#foc', :defaults => {:format => 'json'}
|
||||||
post 'payment/cash' => 'payments#create'
|
post 'payment/cash' => 'payments#create'
|
||||||
|
# post 'payment/kbz_query/:sale_id' => 'payments#kbz_query', :defaults => {:format => 'json'}
|
||||||
post 'payment/mpu' => "mpu#create"
|
post 'payment/mpu' => "mpu#create"
|
||||||
post 'payment/jcb' => "jcb#create"
|
post 'payment/jcb' => "jcb#create"
|
||||||
post 'payment/master' => "master#create"
|
post 'payment/master' => "master#create"
|
||||||
|
|||||||
Reference in New Issue
Block a user