feat: overall foc

This commit is contained in:
DevTeam
2025-07-28 16:44:18 +06:30
parent 904698180c
commit ca6bb56fc3
3 changed files with 15 additions and 2 deletions

View File

@@ -84,7 +84,7 @@ class SalePayment < ApplicationRecord
amount_due = invoice.sale_payments
.map(&:payment_amount).reduce(invoice.grand_total, :-)
end
# byebug
if amount_due > 0
payment_status = false
membership_data = nil
@@ -169,11 +169,20 @@ class SalePayment < ApplicationRecord
end
else
sale_update_payment_status(0)
membership_data = nil
#route to payment type
case payment_method
when "foc"
payment_status = foc_payment
when "paymal"
payment_status, membership_data = paymal_payment
end
#record an payment in sale-audit
remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
sale_audit = SaleAudit.record_payment(invoice.id, remark,action_by.name)
return false, "No outstanding Amount"
return false, "No outstanding Amount", membership_data
end
end