check tax profile process

This commit is contained in:
phyusin
2018-03-21 11:53:27 +06:30
parent b77435be48
commit 0977363518
11 changed files with 37 additions and 33 deletions

View File

@@ -208,8 +208,7 @@ class SalePayment < ApplicationRecord
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
self.payment_status = "paid"
payment_method = self.save!
sale_update_payment_status(self.received_amount)
sale_update_payment_status(self.received_amount)
return payment_status
end
@@ -325,7 +324,7 @@ class SalePayment < ApplicationRecord
sObj = Sale.find(self.sale_id)
is_credit = 0
is_foc = 0
is_cash = false
method_status = false
sObj.sale_payments.each do |spay|
all_received_amount += spay.payment_amount.to_f
if spay.payment_method == "creditnote"
@@ -334,12 +333,12 @@ class SalePayment < ApplicationRecord
if spay.payment_method == "foc"
is_foc = 1
end
if spay.payment_method.to_s == "cash"
is_cash = true
if spay.payment_method == "cash" || spay.payment_method == "foc" || spay.payment_method == "creditnote"
method_status = true
end
end
if (self.sale.grand_total <= all_received_amount) && is_cash
if (self.sale.grand_total <= all_received_amount) && method_status
if is_credit == 0
self.sale.payment_status = "paid"
else
@@ -386,7 +385,7 @@ class SalePayment < ApplicationRecord
elsif paid_amount.to_f > 0 #|| paid_amount != "0.0"
table_update_status(sObj)
update_shift
elsif is_cash && paid_amount.to_f == 0
elsif method_status && paid_amount.to_f == 0
table_update_status(sObj)
update_shift
end