Credit note Rebate Prevent
This commit is contained in:
@@ -306,16 +306,22 @@ class SalePayment < ApplicationRecord
|
||||
if generic_customer_id != nil || generic_customer_id != "" || generic_customer_id != 0
|
||||
paypar = sObj.sale_payments
|
||||
payparcost = 0
|
||||
credit = 0
|
||||
paypar.each do |pp|
|
||||
if pp.payment_method == "paypar"
|
||||
payparcost = payparcost + pp.payment_amount
|
||||
elsif pp.payment_method == "creditnote"
|
||||
credit = 1
|
||||
end
|
||||
end
|
||||
# overall_dis = SaleItem.get_overall_discount(sObj.id)
|
||||
overall_dis = sObj.total_discount
|
||||
|
||||
total_amount = rebate_prices - payparcost - overall_dis
|
||||
if total_amount > 0
|
||||
if credit == 1
|
||||
total_amount = 0
|
||||
end
|
||||
if total_amount >= 0
|
||||
receipt_no = sObj.receipt_no
|
||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
memberaction = MembershipAction.find_by_membership_type("rebate")
|
||||
|
||||
Reference in New Issue
Block a user