feat(Process Statment of Accounts): added show_future_payments filter for account_receivable report type

This commit is contained in:
diptanilsaha
2025-08-29 13:34:03 +05:30
parent 0c400f9355
commit 170fe86f38
3 changed files with 33 additions and 21 deletions

View File

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

View File

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

View File

@@ -52,20 +52,22 @@
</div>
</div>
{% 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) %}
<table class="table table-bordered table-condensed">
@@ -97,25 +99,25 @@
<tr>
<td>{{ _("Total Outstanding") }}</td>
<td class="text-right">
{{ format_number(balance_row["age"], null, 2) }}
{{ frappe.utils.flt(balance_row["age"], 2) }}
</td>
<td class="text-right">
{{ 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"]) }}
</td>
<td class="text-right">
{{ 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"]) }}
</td>
<td class="text-right">
{{ 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"]) }}
</td>
<td class="text-right">
{{ 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"]) }}
</td>
<td class="text-right">
{{ 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"]) }}
</td>
<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=data[data|length-1]["currency"]) }}
</td>
</tr>
<td>{{ _("Future Payments") }}</td>
@@ -126,7 +128,7 @@
<td></td>
<td></td>
<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=data[data|length-1]["currency"]) }}
</td>
<tr class="cvs-footer">
<th class="text-left">{{ _("Cheques Required") }}</th>
@@ -137,7 +139,7 @@
<th></th>
<th></th>
<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=data[data|length-1]["currency"]) }}</th>
</tr>
</tbody>