From 170fe86f3886ad57b84a93ccf15f7a7fd1ffca9f Mon Sep 17 00:00:00 2001 From: diptanilsaha Date: Fri, 29 Aug 2025 13:34:03 +0530 Subject: [PATCH] feat(Process Statment of Accounts): added show_future_payments filter for account_receivable report type --- .../process_statement_of_accounts.json | 10 ++++- .../process_statement_of_accounts.py | 2 + ...ement_of_accounts_accounts_receivable.html | 42 ++++++++++--------- 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json index 08127917c02..964e2921254 100644 --- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json +++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.json @@ -27,6 +27,7 @@ "sales_person", "show_remarks", "based_on_payment_terms", + "show_future_payments", "section_break_3", "customer_collection", "collection_name", @@ -398,10 +399,17 @@ "fieldtype": "Select", "label": "Categorize By", "options": "\nCategorize by Voucher\nCategorize by Voucher (Consolidated)" + }, + { + "default": "0", + "depends_on": "eval:(doc.report == 'Accounts Receivable');", + "fieldname": "show_future_payments", + "fieldtype": "Check", + "label": "Show Future Payments" } ], "links": [], - "modified": "2025-08-04 18:21:12.603623", + "modified": "2025-08-29 00:20:08.088189", "modified_by": "Administrator", "module": "Accounts", "name": "Process Statement Of Accounts", diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py index 76f1e573c41..611ec177daf 100644 --- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py +++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.py @@ -72,6 +72,7 @@ class ProcessStatementOfAccounts(Document): sales_partner: DF.Link | None sales_person: DF.Link | None sender: DF.Link | None + show_future_payments: DF.Check show_net_values_in_party_account: DF.Check show_remarks: DF.Check start_date: DF.Date | None @@ -266,6 +267,7 @@ def get_ar_filters(doc, entry): "sales_person": doc.sales_person if doc.sales_person else None, "territory": doc.territory if doc.territory else None, "based_on_payment_terms": doc.based_on_payment_terms, + "show_future_payments": doc.show_future_payments, "report_name": "Accounts Receivable", "ageing_based_on": doc.ageing_based_on, "range1": 30, diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts_accounts_receivable.html b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts_accounts_receivable.html index 978c6c5521d..8219b6ad990 100644 --- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts_accounts_receivable.html +++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts_accounts_receivable.html @@ -52,20 +52,22 @@ -{% if(filters.show_future_payments) %} - {% set balance_row = data.slice(-1).pop() %} +{% if filters.show_future_payments == 1 %} + {% set balance_row = data[-1] %} + + {% set ns = namespace(idx=None) %} {% for i in report.columns %} - {% if i.fieldname == 'age' %} - {% set elem = i %} + {% if i.fieldname == "age" and ns.idx is none %} + {% set ns.idx = loop.index0 %} {% endif %} {% endfor %} - {% set start = report.columns.findIndex(elem) %} - {% set range1 = report.columns[start].label %} - {% set range2 = report.columns[start+1].label %} - {% set range3 = report.columns[start+2].label %} - {% set range4 = report.columns[start+3].label %} - {% set range5 = report.columns[start+4].label %} - {% set range6 = report.columns[start+5].label %} + + {% set range1 = report.columns[ns.idx].label %} + {% set range2 = report.columns[ns.idx+1].label %} + {% set range3 = report.columns[ns.idx+2].label %} + {% set range4 = report.columns[ns.idx+3].label %} + {% set range5 = report.columns[ns.idx+4].label %} + {% set range6 = report.columns[ns.idx+5].label %} {% if(balance_row) %} @@ -97,25 +99,25 @@ @@ -126,7 +128,7 @@ @@ -137,7 +139,7 @@ + {{ frappe.utils.fmt_money(frappe.utils.flt(balance_row["outstanding"] - balance_row["future_amount"]), currency=data[data|length-1]["currency"]) }}
{{ _("Total Outstanding") }} - {{ format_number(balance_row["age"], null, 2) }} + {{ frappe.utils.flt(balance_row["age"], 2) }} - {{ frappe.utils.fmt_money(balance_row["range1"], data[data.length-1]["currency"]) }} + {{ frappe.utils.fmt_money(balance_row["range1"], currency=data[data|length-1]["currency"]) }} - {{ frappe.utils.fmt_money(balance_row["range2"], data[data.length-1]["currency"]) }} + {{ frappe.utils.fmt_money(balance_row["range2"], currency=data[data|length-1]["currency"]) }} - {{ frappe.utils.fmt_money(balance_row["range3"], data[data.length-1]["currency"]) }} + {{ frappe.utils.fmt_money(balance_row["range3"], currency=data[data|length-1]["currency"]) }} - {{ frappe.utils.fmt_money(balance_row["range4"], data[data.length-1]["currency"]) }} + {{ frappe.utils.fmt_money(balance_row["range4"], currency=data[data|length-1]["currency"]) }} - {{ frappe.utils.fmt_money(balance_row["range5"], data[data.length-1]["currency"]) }} + {{ frappe.utils.fmt_money(balance_row["range5"], currency=data[data|length-1]["currency"]) }} - {{ frappe.utils.fmt_money(flt(balance_row["outstanding"]), data[data.length-1]["currency"]) }} + {{ frappe.utils.fmt_money(frappe.utils.flt(balance_row["outstanding"]), currency=data[data|length-1]["currency"]) }}
{{ _("Future Payments") }} - {{ frappe.utils.fmt_money(flt(balance_row[("future_amount")]), data[data.length-1]["currency"]) }} + {{ frappe.utils.fmt_money(frappe.utils.flt(balance_row["future_amount"]), currency=data[data|length-1]["currency"]) }}