Rebate Redeem amount detect

This commit is contained in:
Phyo
2017-06-12 20:32:12 +06:30
parent dfd7eec2e9
commit 29acbd9bfa

View File

@@ -236,7 +236,19 @@ class SalePayment < ApplicationRecord
def rebat(sObj)
food_prices, beverage_prices = SaleItem.calculate_food_beverage(sObj.sale_items)
generic_customer_id = sObj.customer.membership_id
total_amount = food_prices
if generic_customer_id != nil || generic_customer_id != ""
paypar = sObj.sale_payments
payparcost = 0
paypar.each do |pp|
if pp.payment_method == "paypar"
payparcost = payparcost + pp.payment_amount
end
end
total_amount = food_prices - payparcost
puts "aaaa"
puts food_prices
puts payparcost
puts total_amount
receipt_no = sObj.receipt_no
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("rebate")
@@ -252,6 +264,7 @@ class SalePayment < ApplicationRecord
puts response.to_json
end
end
private
def generate_custom_id