Change Amount Bug Fix

This commit is contained in:
Phyo
2017-06-13 19:41:51 +06:30
parent db2cce3dfa
commit 57f7f1037d

View File

@@ -212,7 +212,8 @@ class SalePayment < ApplicationRecord
def sale_update_payment_status(paid_amount) def sale_update_payment_status(paid_amount)
#update amount_outstanding #update amount_outstanding
self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f
self.sale.amount_changed = paid_amount.to_f - self.sale.amount_received.to_f
self.sale.amount_changed = self.sale.amount_received.to_f - self.sale.grand_total.to_f
all_received_amount = 0.0 all_received_amount = 0.0
sObj = Sale.find(self.sale_id) sObj = Sale.find(self.sale_id)
sObj.sale_payments.each do |spay| sObj.sale_payments.each do |spay|