From c051536182531f3362cd8002c5b1f5adcdb470e7 Mon Sep 17 00:00:00 2001 From: Shllokkk Date: Fri, 27 Mar 2026 12:32:17 +0530 Subject: [PATCH 1/3] 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 From 2bf9d4179744eb53970410d8f9bc70158c453f62 Mon Sep 17 00:00:00 2001 From: Shllokkk Date: Fri, 27 Mar 2026 12:57:23 +0530 Subject: [PATCH 2/3] feat: add print format for accounts payable report --- .../accounts_payable_standard/__init__.py | 0 .../accounts_payable_standard.json | 33 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 erpnext/accounts/print_format/accounts_payable_standard/__init__.py create mode 100644 erpnext/accounts/print_format/accounts_payable_standard/accounts_payable_standard.json diff --git a/erpnext/accounts/print_format/accounts_payable_standard/__init__.py b/erpnext/accounts/print_format/accounts_payable_standard/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/accounts/print_format/accounts_payable_standard/accounts_payable_standard.json b/erpnext/accounts/print_format/accounts_payable_standard/accounts_payable_standard.json new file mode 100644 index 00000000000..ac895ba2b33 --- /dev/null +++ b/erpnext/accounts/print_format/accounts_payable_standard/accounts_payable_standard.json @@ -0,0 +1,33 @@ +{ + "absolute_value": 0, + "align_labels_right": 0, + "creation": "2026-03-27 12:52:58.345285", + "custom_format": 1, + "default_print_language": "en", + "disabled": 0, + "docstatus": 0, + "doctype": "Print Format", + "font_size": 14, + "html": "\n\n
\n\n
\n\n \n
\n
\n {%= __(report.report_name) %}\n
\n
\n\n \n
\n
\n
\n {%= __(\"Supplier\") %}:\n {%= (filters.party.length && filters.party.join(\", \")) || __(\"All Parties\") %}\n
\n
\n\n
\n
\n {%= __(\"Report Date\") %}:\n {%= frappe.datetime.str_to_user(filters.report_date) %}\n
\n
\n
\n\n \n
\n \n \n \n \n \n\n {% if(filters.show_remarks) { %}\n \n {% } %}\n\n \n \n \n \n \n\n \n {% for(var i=0, l=data.length; i\n \n\n \n\n {% if(filters.show_remarks) { %}\n \n {% } %}\n\n \n \n \n \n {% } %}\n \n
{%= __(\"Date\") %}{%= __(\"Reference\") %}{%= __(\"Remarks\") %}{%= __(\"Age (Days)\") %}{%= __(\"Invoiced Amount\") %}{%= __(\"Outstanding Amount\") %}
{%= frappe.datetime.str_to_user(data[i][\"posting_date\"]) %}\n {% if(i == data.length - 1) { %}\n {%= __(\"Total\") %}\n {% } else { %}\n {%= data[i][\"voucher_no\"] %}\n {% } %}\n \n {% if(data[i][\"remarks\"] && data[i][\"remarks\"] != \"No Remarks\") { %}\n {%= data[i][\"remarks\"] %}\n {% } %}\n {%= data[i][\"age\"] %}{%= format_currency(data[i][\"invoiced\"], data[i][\"currency\"]) %}{%= format_currency(data[i][\"outstanding\"], data[i][\"currency\"]) %}
\n
\n\n  \n\n {% if(filters.show_future_payments) { %}\n {%\n var balance_row = data.slice(-1).pop();\n var start = report.columns.findIndex(e => e.fieldname == 'age');\n var currency = data[data.length - 1][\"currency\"];\n\n var ranges = [\n report.columns[start].label,\n report.columns[start+1].label,\n report.columns[start+2].label,\n report.columns[start+3].label,\n report.columns[start+4].label,\n report.columns[start+5].label\n ];\n %}\n\n {% if(balance_row) { %}\n
\n \n \n \n \n {% for(var i = 0; i < ranges.length; i++) { %}\n \n {% } %}\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
{%= __(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) %}
\n
\n {% } %}\n {% } %}\n\n

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

\n\n
", + "idx": 0, + "line_breaks": 0, + "margin_bottom": 15.0, + "margin_left": 15.0, + "margin_right": 15.0, + "margin_top": 15.0, + "modified": "2026-03-27 16:02:44.654828", + "modified_by": "Administrator", + "module": "Accounts", + "name": "Accounts Payable Standard", + "owner": "Administrator", + "page_number": "Hide", + "pdf_generator": "chrome", + "print_format_builder": 0, + "print_format_builder_beta": 0, + "print_format_for": "Report", + "print_format_type": "JS", + "raw_printing": 0, + "report": "Accounts Payable", + "show_section_headings": 0, + "standard": "Yes" +} From 915fcc0166217bdf84344495fab0df4d08c945e1 Mon Sep 17 00:00:00 2001 From: Shllokkk Date: Sun, 12 Apr 2026 13:07:41 +0530 Subject: [PATCH 3/3] fix: minor changes in print template --- .../accounts_payable/accounts_payable.html | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/erpnext/accounts/report/accounts_payable/accounts_payable.html b/erpnext/accounts/report/accounts_payable/accounts_payable.html index 46b40017034..a1b03dad5a8 100644 --- a/erpnext/accounts/report/accounts_payable/accounts_payable.html +++ b/erpnext/accounts/report/accounts_payable/accounts_payable.html @@ -78,6 +78,10 @@ font-weight: 500; } + .report-subtitle { + margin: 10px 0 14px; + } + @media print { @page { size: A4; @@ -92,31 +96,34 @@
-
{%= __(report.report_name) %}
- -
-
-
- {%= __("Supplier") %}: - {%= (filters.party.length && filters.party.join(", ")) || __("All Parties") %} + {% if (subtitle && subtitle.trim()) { %} +
+ {{ subtitle }} +
+ {% } else { %} +
+
+
+ {%= __("Supplier") %}: + {%= (filters.party.length && filters.party.join(", ")) || __("All Parties") %} +
+
+ +
+
+ {%= __("Report Date") %}: + {%= frappe.datetime.str_to_user(filters.report_date) %} +
+ {% } %} -
-
- {%= __("Report Date") %}: - {%= frappe.datetime.str_to_user(filters.report_date) %} -
-
-
- -