mirror of
https://github.com/frappe/erpnext.git
synced 2025-12-03 18:35:36 +00:00
fix(accounts-payable-summary): add Show GL Balance check similar to Accounts Receivable Summary
(cherry picked from commit 8a7e5d0626)
# Conflicts:
# erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
This commit is contained in:
@@ -102,6 +102,11 @@ frappe.query_reports["Accounts Payable Summary"] = {
|
|||||||
label: __("Revaluation Journals"),
|
label: __("Revaluation Journals"),
|
||||||
fieldtype: "Check",
|
fieldtype: "Check",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
fieldname: "show_gl_balance",
|
||||||
|
label: __("Show GL Balance"),
|
||||||
|
fieldtype: "Check",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
onload: function (report) {
|
onload: function (report) {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class AccountsReceivableSummary(ReceivablePayableReport):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if self.filters.show_gl_balance:
|
if self.filters.show_gl_balance:
|
||||||
gl_balance_map = get_gl_balance(self.filters.report_date, self.filters.company)
|
gl_balance_map = get_gl_balance(self.filters.report_date, self.filters.company, self.account_type)
|
||||||
|
|
||||||
for party, party_dict in self.party_total.items():
|
for party, party_dict in self.party_total.items():
|
||||||
if flt(party_dict.outstanding, self.currency_precision) == 0:
|
if flt(party_dict.outstanding, self.currency_precision) == 0:
|
||||||
@@ -206,11 +206,15 @@ class AccountsReceivableSummary(ReceivablePayableReport):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_gl_balance(report_date, company):
|
def get_gl_balance(report_date, company, account_type):
|
||||||
|
if account_type == "Payable":
|
||||||
|
balance_calc_fields = ["party", {"SUM": [{"SUB": ["credit", "debit"]}], "as": "balance"}]
|
||||||
|
else:
|
||||||
|
balance_calc_fields = ["party", {"SUM": [{"SUB": ["debit", "credit"]}], "as": "balance"}]
|
||||||
return frappe._dict(
|
return frappe._dict(
|
||||||
frappe.db.get_all(
|
frappe.db.get_all(
|
||||||
"GL Entry",
|
"GL Entry",
|
||||||
fields=["party", "sum(debit - credit)"],
|
fields=balance_calc_fields,
|
||||||
filters={"posting_date": ("<=", report_date), "is_cancelled": 0, "company": company},
|
filters={"posting_date": ("<=", report_date), "is_cancelled": 0, "company": company},
|
||||||
group_by="party",
|
group_by="party",
|
||||||
as_list=1,
|
as_list=1,
|
||||||
|
|||||||
Reference in New Issue
Block a user