update sale order talble

This commit is contained in:
Nweni
2017-06-09 13:13:20 +06:30
parent 6171b00dc7
commit 56ffd1f063
9 changed files with 34 additions and 23 deletions

View File

@@ -207,7 +207,7 @@ class SalePayment < ApplicationRecord
def sale_update_payment_status(paid_amount)
#update amount_outstanding
self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f
self.sale.amount_changed = paid_amount - self.sale.amount_received
self.sale.amount_changed = paid_amount.to_f - self.sale.amount_received.to_f
if (self.sale.grand_total <= self.sale.amount_received.to_f && self.sale.amount_changed.to_f > 0)
self.sale.payment_status = "paid"
self.sale.sale_status = "completed"