SQA feedback
This commit is contained in:
@@ -325,6 +325,7 @@ class SalePayment < ApplicationRecord
|
||||
sObj = Sale.find(self.sale_id)
|
||||
is_credit = 0
|
||||
is_foc = 0
|
||||
is_cash = false
|
||||
sObj.sale_payments.each do |spay|
|
||||
all_received_amount += spay.payment_amount.to_f
|
||||
if spay.payment_method == "creditnote"
|
||||
@@ -333,8 +334,12 @@ class SalePayment < ApplicationRecord
|
||||
if spay.payment_method == "foc"
|
||||
is_foc = 1
|
||||
end
|
||||
if spay.payment_method.to_s == "cash"
|
||||
is_cash = true
|
||||
end
|
||||
end
|
||||
if (self.sale.grand_total <= all_received_amount)
|
||||
|
||||
if (self.sale.grand_total <= all_received_amount) && is_cash
|
||||
if is_credit == 0
|
||||
self.sale.payment_status = "paid"
|
||||
else
|
||||
@@ -374,11 +379,15 @@ class SalePayment < ApplicationRecord
|
||||
end
|
||||
|
||||
self.sale.save!
|
||||
table_update_status(sObj)
|
||||
|
||||
if check_foc
|
||||
table_update_status(sObj)
|
||||
update_shift
|
||||
elsif paid_amount.to_f > 0 #|| paid_amount != "0.0"
|
||||
table_update_status(sObj)
|
||||
update_shift
|
||||
elsif is_cash && paid_amount.to_f == 0
|
||||
table_update_status(sObj)
|
||||
update_shift
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user