From c051536182531f3362cd8002c5b1f5adcdb470e7 Mon Sep 17 00:00:00 2001 From: Shllokkk Date: Fri, 27 Mar 2026 12:32:17 +0530 Subject: [PATCH] refactor: revamp print template for accounts payable report --- .../accounts_payable/accounts_payable.html | 221 +++++++++++++++++- 1 file changed, 220 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.html b/erpnext/accounts/report/accounts_payable/accounts_payable.html index d3020b22a40..46b40017034 100644 --- a/erpnext/accounts/report/accounts_payable/accounts_payable.html +++ b/erpnext/accounts/report/accounts_payable/accounts_payable.html @@ -1 +1,220 @@ -{% include "accounts/report/accounts_receivable/accounts_receivable.html" %} + + +
+ +
+ + +
+
+ {%= __(report.report_name) %} +
+
+ + +
+
+
+ {%= __("Supplier") %}: + {%= (filters.party.length && filters.party.join(", ")) || __("All Parties") %} +
+
+ +
+
+ {%= __("Report Date") %}: + {%= frappe.datetime.str_to_user(filters.report_date) %} +
+
+
+ + +
+ + + + + + + {% if(filters.show_remarks) { %} + + {% } %} + + + + + + + + + {% for(var i=0, l=data.length; i + + + + + {% if(filters.show_remarks) { %} + + {% } %} + + + + + + {% } %} + +
{%= __("Date") %}{%= __("Reference") %}{%= __("Remarks") %}{%= __("Age (Days)") %}{%= __("Invoiced Amount") %}{%= __("Outstanding Amount") %}
{%= frappe.datetime.str_to_user(data[i]["posting_date"]) %} + {% if(i == data.length - 1) { %} + {%= __("Total") %} + {% } else { %} + {%= data[i]["voucher_no"] %} + {% } %} + + {% if(data[i]["remarks"] && data[i]["remarks"] != "No Remarks") { %} + {%= data[i]["remarks"] %} + {% } %} + {%= data[i]["age"] %}{%= format_currency(data[i]["invoiced"], data[i]["currency"]) %}{%= format_currency(data[i]["outstanding"], data[i]["currency"]) %}
+
+ +   + + {% if(filters.show_future_payments) { %} + {% + var balance_row = data.slice(-1).pop(); + var start = report.columns.findIndex(e => e.fieldname == 'age'); + var currency = data[data.length - 1]["currency"]; + + var ranges = [ + report.columns[start].label, + report.columns[start+1].label, + report.columns[start+2].label, + report.columns[start+3].label, + report.columns[start+4].label, + report.columns[start+5].label + ]; + %} + + {% if(balance_row) { %} +
+ + + + + {% for(var i = 0; i < ranges.length; i++) { %} + + {% } %} + + + + + + + + + + + + + + + +
{%= __(ranges[i]) %}{%= __("Total") %}
{%= __("Total Outstanding") %}{%= format_number(balance_row["age"], null, 2) %}{%= format_currency(balance_row["range1"], currency) %}{%= format_currency(balance_row["range2"], currency) %}{%= format_currency(balance_row["range3"], currency) %}{%= format_currency(balance_row["range4"], currency) %}{%= format_currency(balance_row["range5"], currency) %}{%= format_currency(flt(balance_row["outstanding"]), currency) %}
+
+ {% } %} + {% } %} + +

+ {%= __("Printed on {0}", [ + frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) + ]) %} +

+ +
\ No newline at end of file