fix: advance amount is not calculating properly

This commit is contained in:
Rohit Waghchaure 2019-03-19 15:06:01 +05:30
parent 2ae018a653
commit 1a6e01542a
2 changed files with 6 additions and 3 deletions

View File

@ -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)

View File

@ -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,
]