From 1a6e01542afbb4153762e48e29ce862fa2af7c65 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 19 Mar 2019 15:06:01 +0530 Subject: [PATCH] fix: advance amount is not calculating properly --- erpnext/accounts/party.py | 6 ++++-- .../accounts_receivable_summary.py | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 5855ac3bcd..70e4800784 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -576,8 +576,10 @@ def get_party_shipping_address(doctype, name): def get_partywise_advanced_payment_amount(party_type="Customer"): data = frappe.db.sql(""" SELECT party, sum({0}) as amount FROM `tabGL Entry` - WHERE party_type = %s and against_voucher is null GROUP BY party""" - .format(("credit - debit") if party_type == "Customer" else "debit") , party_type) + WHERE + party_type = %s and against_voucher is null + GROUP BY party""" + .format(("credit") if party_type == "Customer" else "debit") , party_type) if data: return frappe._dict(data) \ No newline at end of file diff --git a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py index 73ca8b48ef..b6388f9771 100644 --- a/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py +++ b/erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py @@ -144,9 +144,10 @@ class AccountsReceivableSummary(ReceivablePayableReport): row += [self.get_party_name(args.get("party_type"), party)] row += [partywise_advance_amount.get(party, 0)] + paid_amt = flt(party_dict.paid_amt - partywise_advance_amount.get(party, 0)) row += [ - party_dict.invoiced_amt, party_dict.paid_amt, party_dict.credit_amt, party_dict.outstanding_amt, + party_dict.invoiced_amt, paid_amt, party_dict.credit_amt, party_dict.outstanding_amt, party_dict.range1, party_dict.range2, party_dict.range3, party_dict.range4, ]