Added on account amount field in Accounts Payable/Receivable Summary

This commit is contained in:
Rohit Waghchaure 2019-01-15 17:38:31 +05:30
parent 1a4c1e11cb
commit affeb3dfec
2 changed files with 19 additions and 0 deletions

View File

@ -562,3 +562,12 @@ def get_party_shipping_address(doctype, name):
return out[0][0]
else:
return ''
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" if party_type == "Customer" else "debit") , party_type, debug=1)
if data:
return frappe._dict(data)

View File

@ -5,6 +5,7 @@ from __future__ import unicode_literals
import frappe
from frappe import _, scrub
from frappe.utils import flt
from erpnext.accounts.party import get_partywise_advanced_payment_amount
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
from six import iteritems
@ -24,6 +25,12 @@ class AccountsReceivableSummary(ReceivablePayableReport):
credit_debit_label = "Credit Note Amt" if args.get('party_type') == 'Customer' else "Debit Note Amt"
columns += [{
"label": _("On Account Amount"),
"fieldname": "on_account_amt",
"fieldtype": "Currency",
"options": "currency",
"width": 100
},{
"label": _("Total Invoiced Amt"),
"fieldname": "total_invoiced_amt",
"fieldtype": "Currency",
@ -129,12 +136,15 @@ class AccountsReceivableSummary(ReceivablePayableReport):
partywise_total = self.get_partywise_total(party_naming_by, args)
partywise_advance_amount = get_partywise_advanced_payment_amount(args.get("party_type")) or {}
for party, party_dict in iteritems(partywise_total):
row = [party]
if party_naming_by == "Naming Series":
row += [self.get_party_name(args.get("party_type"), party)]
row += [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.range1, party_dict.range2, party_dict.range3, party_dict.range4,