disable no rebate if credit note

This commit is contained in:
Yan
2017-12-12 10:35:26 +06:30
parent d80c7840cc
commit f11145cbd1

View File

@@ -323,7 +323,7 @@ class SalePayment < ApplicationRecord
self.sale.sale_status = "completed" self.sale.sale_status = "completed"
if MembershipSetting.find_by_rebate(1) && is_foc == 0 if MembershipSetting.find_by_rebate(1) && is_foc == 0 && is_credit == 0
response = rebat(sObj) response = rebat(sObj)
#record an payment in sale-audit #record an payment in sale-audit
@@ -410,6 +410,7 @@ class SalePayment < ApplicationRecord
# overall_dis = SaleItem.get_overall_discount(sObj.id) # overall_dis = SaleItem.get_overall_discount(sObj.id)
overall_dis = sObj.total_discount overall_dis = sObj.total_discount
if credit != 1
membership = MembershipSetting.find_by_membership_type("paypar_url") membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("get_member_campaign") memberaction = MembershipAction.find_by_membership_type("get_member_campaign")
merchant_uid = memberaction.merchant_account_id.to_s merchant_uid = memberaction.merchant_account_id.to_s
@@ -438,6 +439,7 @@ class SalePayment < ApplicationRecord
rescue SocketError rescue SocketError
response = { "status": false, "message": "Can't connect server"} response = { "status": false, "message": "Can't connect server"}
end end
redeem_amount = payparcost + overall_dis redeem_amount = payparcost + overall_dis
total_percentage = 0 total_percentage = 0
@@ -478,6 +480,7 @@ class SalePayment < ApplicationRecord
if credit == 1 if credit == 1
total_amount = 0 total_amount = 0
end end
if total_amount >= 0 if total_amount >= 0
receipt_no = sObj.receipt_no receipt_no = sObj.receipt_no
membership = MembershipSetting.find_by_membership_type("paypar_url") membership = MembershipSetting.find_by_membership_type("paypar_url")
@@ -516,9 +519,9 @@ class SalePayment < ApplicationRecord
Rails.logger.debug response.to_json Rails.logger.debug response.to_json
return response return response
end end
end
else else
response = { "status": "no_member", "message": "Not membership"} response = { "status": "no_member", "message": "Not membership"}
end end
end end