fix shift sale balance
This commit is contained in:
@@ -1424,7 +1424,7 @@ end
|
||||
|
||||
def get_cash_amount
|
||||
self.sale_payments.where(payment_method: 'cash', payment_status: 'paid')
|
||||
.pluck(:payment_amount).reduce(:+)
|
||||
.pluck(:payment_amount).reduce(0, :+) - self.amount_changed
|
||||
end
|
||||
|
||||
def get_credit_amount
|
||||
@@ -2309,15 +2309,13 @@ private
|
||||
end
|
||||
|
||||
def round_to_precision
|
||||
if (self.total_amount != self.total_amount_was || self.total_discount != self.total_discount_was || self.total_tax != self.total_tax_was)
|
||||
if (self.total_amount % 1 > 0 || self.total_discount % 1 > 0 || self.total_tax % 1 > 0)
|
||||
self.total_amount = self.total_amount.round(precision)
|
||||
self.total_discount = self.total_discount.round(precision)
|
||||
self.total_tax = self.total_tax.round(precision)
|
||||
self.grand_total = (self.total_amount - self.total_discount) + self.total_tax
|
||||
end
|
||||
adjust_rounding
|
||||
if (self.total_amount % 1 > 0 || self.total_discount % 1 > 0 || self.total_tax % 1 > 0)
|
||||
self.total_amount = self.total_amount.round(precision)
|
||||
self.total_discount = self.total_discount.round(precision)
|
||||
self.total_tax = self.total_tax.round(precision)
|
||||
self.grand_total = (self.total_amount - self.total_discount) + self.total_tax
|
||||
end
|
||||
adjust_rounding
|
||||
end
|
||||
|
||||
def update_stock_journal
|
||||
|
||||
Reference in New Issue
Block a user