update foc and void overall add remark

This commit is contained in:
Aung Myo
2018-02-23 14:53:08 +06:30
parent 643a9d71be
commit 77a66d726b
6 changed files with 162 additions and 53 deletions

View File

@@ -8,7 +8,7 @@ class SalePayment < ApplicationRecord
attr_accessor :received_amount, :card_payment_reference, :voucher_no, :giftcard_no, :customer_id, :external_payment_status
def process_payment(invoice, action_by, cash_amount, payment_method)
def process_payment(invoice, action_by, cash_amount, payment_method,remark=nil)
self.sale = invoice
self.received_amount = cash_amount
amount_due = invoice.grand_total
@@ -53,7 +53,7 @@ class SalePayment < ApplicationRecord
end
#record an payment in sale-audit
remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{cash_amount} | Payment Status ->#{payment_status}"
# remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{cash_amount} | Payment Status ->#{payment_status}"
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
# update complete order items in oqs
@@ -67,7 +67,7 @@ class SalePayment < ApplicationRecord
return true, self.save
else
#record an payment in sale-audit
remark = "No outstanding Amount - Grand Total [#{invoice.grand_total}] | Due [#{amount_due}] | Paid [#{invoice.amount_received}]"
# 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)
return false, "No outstanding Amount"