Merge pull request #49373 from diptanilsaha/psoa_ar_future_payments

feat(Process Statment of Accounts): added show_future_payments filter for account_receivable report type
This commit is contained in:
Diptanil Saha
2025-08-29 18:02:26 +05:30
committed by GitHub
3 changed files with 34 additions and 22 deletions

View File

@@ -27,6 +27,7 @@
"sales_person", "sales_person",
"show_remarks", "show_remarks",
"based_on_payment_terms", "based_on_payment_terms",
"show_future_payments",
"section_break_3", "section_break_3",
"customer_collection", "customer_collection",
"collection_name", "collection_name",
@@ -398,10 +399,17 @@
"fieldtype": "Select", "fieldtype": "Select",
"label": "Categorize By", "label": "Categorize By",
"options": "\nCategorize by Voucher\nCategorize by Voucher (Consolidated)" "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": [], "links": [],
"modified": "2025-08-04 18:21:12.603623", "modified": "2025-08-29 00:20:08.088189",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Process Statement Of Accounts", "name": "Process Statement Of Accounts",

View File

@@ -72,6 +72,7 @@ class ProcessStatementOfAccounts(Document):
sales_partner: DF.Link | None sales_partner: DF.Link | None
sales_person: DF.Link | None sales_person: DF.Link | None
sender: DF.Link | None sender: DF.Link | None
show_future_payments: DF.Check
show_net_values_in_party_account: DF.Check show_net_values_in_party_account: DF.Check
show_remarks: DF.Check show_remarks: DF.Check
start_date: DF.Date | None 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, "sales_person": doc.sales_person if doc.sales_person else None,
"territory": doc.territory if doc.territory else None, "territory": doc.territory if doc.territory else None,
"based_on_payment_terms": doc.based_on_payment_terms, "based_on_payment_terms": doc.based_on_payment_terms,
"show_future_payments": doc.show_future_payments,
"report_name": "Accounts Receivable", "report_name": "Accounts Receivable",
"ageing_based_on": doc.ageing_based_on, "ageing_based_on": doc.ageing_based_on,
"range1": 30, "range1": 30,

View File

@@ -52,20 +52,22 @@
</div> </div>
</div> </div>
{% if(filters.show_future_payments) %} {% if(filters.show_future_payments)%}
{% set balance_row = data.slice(-1).pop() %} {% set balance_row = data[-1] %}
{% set ns = namespace(idx=None) %}
{% for i in report.columns %} {% for i in report.columns %}
{% if i.fieldname == 'age' %} {% if i.fieldname == "age" and ns.idx is none %}
{% set elem = i %} {% set ns.idx = loop.index0 %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% set start = report.columns.findIndex(elem) %}
{% set range1 = report.columns[start].label %} {% set age = report.columns[ns.idx].label %}
{% set range2 = report.columns[start+1].label %} {% set range1 = report.columns[ns.idx+1].label %}
{% set range3 = report.columns[start+2].label %} {% set range2 = report.columns[ns.idx+2].label %}
{% set range4 = report.columns[start+3].label %} {% set range3 = report.columns[ns.idx+3].label %}
{% set range5 = report.columns[start+4].label %} {% set range4 = report.columns[ns.idx+4].label %}
{% set range6 = report.columns[start+5].label %} {% set range5 = report.columns[ns.idx+5].label %}
{% if(balance_row) %} {% if(balance_row) %}
<table class="table table-bordered table-condensed"> <table class="table table-bordered table-condensed">
@@ -84,12 +86,12 @@
<thead> <thead>
<tr> <tr>
<th>{{ _(" ") }}</th> <th>{{ _(" ") }}</th>
<th>{{ _(age) }}</th>
<th>{{ _(range1) }}</th> <th>{{ _(range1) }}</th>
<th>{{ _(range2) }}</th> <th>{{ _(range2) }}</th>
<th>{{ _(range3) }}</th> <th>{{ _(range3) }}</th>
<th>{{ _(range4) }}</th> <th>{{ _(range4) }}</th>
<th>{{ _(range5) }}</th> <th>{{ _(range5) }}</th>
<th>{{ _(range6) }}</th>
<th>{{ _("Total") }}</th> <th>{{ _("Total") }}</th>
</tr> </tr>
</thead> </thead>
@@ -97,25 +99,25 @@
<tr> <tr>
<td>{{ _("Total Outstanding") }}</td> <td>{{ _("Total Outstanding") }}</td>
<td class="text-right"> <td class="text-right">
{{ format_number(balance_row["age"], null, 2) }} {{ frappe.utils.flt(balance_row["age"], 2) }}
</td> </td>
<td class="text-right"> <td class="text-right">
{{ frappe.utils.fmt_money(balance_row["range1"], data[data.length-1]["currency"]) }} {{ frappe.utils.fmt_money(balance_row["range1"], currency=balance_row["currency"]) }}
</td> </td>
<td class="text-right"> <td class="text-right">
{{ frappe.utils.fmt_money(balance_row["range2"], data[data.length-1]["currency"]) }} {{ frappe.utils.fmt_money(balance_row["range2"], currency=balance_row["currency"]) }}
</td> </td>
<td class="text-right"> <td class="text-right">
{{ frappe.utils.fmt_money(balance_row["range3"], data[data.length-1]["currency"]) }} {{ frappe.utils.fmt_money(balance_row["range3"], currency=balance_row["currency"]) }}
</td> </td>
<td class="text-right"> <td class="text-right">
{{ frappe.utils.fmt_money(balance_row["range4"], data[data.length-1]["currency"]) }} {{ frappe.utils.fmt_money(balance_row["range4"], currency=balance_row["currency"]) }}
</td> </td>
<td class="text-right"> <td class="text-right">
{{ frappe.utils.fmt_money(balance_row["range5"], data[data.length-1]["currency"]) }} {{ frappe.utils.fmt_money(balance_row["range5"], currency=balance_row["currency"]) }}
</td> </td>
<td class="text-right"> <td class="text-right">
{{ frappe.utils.fmt_money(flt(balance_row["outstanding"]), data[data.length-1]["currency"]) }} {{ frappe.utils.fmt_money(frappe.utils.flt(balance_row["outstanding"]), currency=balance_row["currency"]) }}
</td> </td>
</tr> </tr>
<td>{{ _("Future Payments") }}</td> <td>{{ _("Future Payments") }}</td>
@@ -126,7 +128,7 @@
<td></td> <td></td>
<td></td> <td></td>
<td class="text-right"> <td class="text-right">
{{ 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=balance_row["currency"]) }}
</td> </td>
<tr class="cvs-footer"> <tr class="cvs-footer">
<th class="text-left">{{ _("Cheques Required") }}</th> <th class="text-left">{{ _("Cheques Required") }}</th>
@@ -137,7 +139,7 @@
<th></th> <th></th>
<th></th> <th></th>
<th class="text-right"> <th class="text-right">
{{ frappe.utils.fmt_money(flt(balance_row["outstanding"] - balance_row[("future_amount")]), data[data.length-1]["currency"]) }}</th> {{ frappe.utils.fmt_money(frappe.utils.flt(balance_row["outstanding"] - balance_row["future_amount"]), currency=balance_row["currency"]) }}</th>
</tr> </tr>
</tbody> </tbody>