From ab1ae418ccac57709c6feb4b0f53375eba271997 Mon Sep 17 00:00:00 2001 From: Anuja P Date: Thu, 13 May 2021 14:26:27 +0530 Subject: [PATCH 1/2] fix: Process SOA enhancement --- .../process_statement_of_accounts.html | 118 +++++++++++------- .../process_statement_of_accounts.json | 19 ++- .../process_statement_of_accounts.py | 8 +- 3 files changed, 93 insertions(+), 52 deletions(-) diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.html b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.html index b623898829..b3aca53139 100644 --- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.html +++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.html @@ -1,24 +1,43 @@ -

{{ filters.party[0] }}

-

{{ _("Statement of Accounts") }}

+
+
+ {% if letter_head %} +
{{ letter_head.content }}
+
+ {% endif %} +
+ -
- {{ frappe.format(filters.from_date, 'Date')}} - {{ _("to") }} - {{ frappe.format(filters.to_date, 'Date')}} -
+

{{ _("STATEMENTS OF ACCOUNTS") }}

+
+
{{ _("Customer: ") }} {{filters.party[0] }}
+
+ {{ _("Date: ") }} + {{ frappe.format(filters.from_date, 'Date')}} + {{ _("to") }} + {{ frappe.format(filters.to_date, 'Date')}} +
+
+
- - - - - - - - - - - - +
{{ _("Date") }}{{ _("Ref") }}{{ _("Party") }}{{ _("Debit") }}{{ _("Credit") }}{{ _("Balance (Dr - Cr)") }}
+ + + + + + + + + + + {% for row in data %} {% if(row.posting_date) %} @@ -58,32 +77,35 @@ {% endfor %} -
{{ _("Date") }}{{ _("Reference") }}{{ _("Remarks") }}{{ _("Debit") }}{{ _("Credit") }}{{ _("Balance (Dr - Cr)") }}
-

-{% if aging %} -

{{ _("Ageing Report Based On ") }} {{ aging.ageing_based_on }}

-
- {{ _("Up to " ) }} {{ frappe.format(filters.to_date, 'Date')}} -
-
- - - - - - - - - - - - - - - - - - -
30 Days60 Days90 Days120 Days
{{ frappe.utils.fmt_money(aging.range1, currency=filters.presentation_currency) }}{{ frappe.utils.fmt_money(aging.range2, currency=filters.presentation_currency) }}{{ frappe.utils.fmt_money(aging.range3, currency=filters.presentation_currency) }}{{ frappe.utils.fmt_money(aging.range4, currency=filters.presentation_currency) }}
-{% endif %} -

Printed On {{ frappe.format(frappe.utils.get_datetime(), 'Datetime') }}

\ No newline at end of file + +
+ {% if aging %} +

{{ _("Ageing Report based on ") }} {{ aging.ageing_based_on }} + {{ _("up to " ) }} {{ frappe.format(filters.to_date, 'Date')}} +

+ + + + + + + + + + + + + + + + + +
30 Days60 Days90 Days120 Days
{{ frappe.utils.fmt_money(aging.range1, currency=filters.presentation_currency) }}{{ frappe.utils.fmt_money(aging.range2, currency=filters.presentation_currency) }}{{ frappe.utils.fmt_money(aging.range3, currency=filters.presentation_currency) }}{{ frappe.utils.fmt_money(aging.range4, currency=filters.presentation_currency) }}
+ {% endif %} + + {% if terms_and_conditions %} +
+ {{ terms_and_conditions }} +
+ {% endif %} +
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 4be0e2ec06..922f6367df 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 @@ -1,6 +1,5 @@ { "actions": [], - "allow_workflow": 1, "autoname": "Prompt", "creation": "2020-05-22 16:46:18.712954", "doctype": "DocType", @@ -28,9 +27,11 @@ "customers", "preferences", "orientation", - "section_break_14", "include_ageing", "ageing_based_on", + "section_break_14", + "letter_head", + "terms_and_conditions", "section_break_1", "enable_auto_email", "section_break_18", @@ -270,10 +271,22 @@ "fieldname": "body", "fieldtype": "Text Editor", "label": "Body" + }, + { + "fieldname": "letter_head", + "fieldtype": "Link", + "label": "Letter Head", + "options": "Letter Head" + }, + { + "fieldname": "terms_and_conditions", + "fieldtype": "Link", + "label": "Terms and Conditions", + "options": "Terms and Conditions" } ], "links": [], - "modified": "2020-08-08 08:47:09.185728", + "modified": "2021-05-13 12:44:19.574844", "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 b6149e89f5..c388669592 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 @@ -62,6 +62,9 @@ def get_report_pdf(doc, consolidated=True): tax_id = frappe.get_doc('Customer', entry.customer).tax_id presentation_currency = get_party_account_currency('Customer', entry.customer, doc.company) \ or doc.currency or get_company_currency(doc.company) + if doc.letter_head: + from frappe.www.printview import get_letter_head + letter_head = get_letter_head(doc, 0) filters= frappe._dict({ 'from_date': doc.from_date, @@ -88,7 +91,10 @@ def get_report_pdf(doc, consolidated=True): if len(res) == 3: continue html = frappe.render_template(template_path, \ - {"filters": filters, "data": res, "aging": aging[0] if doc.include_ageing else None}) + {"filters": filters, "data": res, "aging": aging[0] if doc.include_ageing else None, + "letter_head": letter_head if doc.letter_head else None, + "terms_and_conditions": frappe.db.get_value('Terms and Conditions', doc.terms_and_conditions, 'terms') + if doc.terms_and_conditions else None}) html = frappe.render_template(base_template_path, {"body": html, \ "css": get_print_style(), "title": "Statement For " + entry.customer}) statement_dict[entry.customer] = html From e90a2a346b9de9efe1a0abd13c804568dfc27343 Mon Sep 17 00:00:00 2001 From: Anuja P Date: Thu, 13 May 2021 15:15:47 +0530 Subject: [PATCH 2/2] fix: update new changes --- .../process_statement_of_accounts.html | 12 ++++++------ .../process_statement_of_accounts.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.html b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.html index f44d595332..db1fea192e 100644 --- a/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.html +++ b/erpnext/accounts/doctype/process_statement_of_accounts/process_statement_of_accounts.html @@ -79,8 +79,8 @@
- {% if aging %} -

{{ _("Ageing Report based on ") }} {{ aging.ageing_based_on }} + {% if ageing %} +

{{ _("Ageing Report based on ") }} {{ ageing.ageing_based_on }} {{ _("up to " ) }} {{ frappe.format(filters.to_date, 'Date')}}

@@ -94,10 +94,10 @@ - - - - + + + +
{{ frappe.utils.fmt_money(aging.range1, currency=filters.presentation_currency) }}{{ frappe.utils.fmt_money(aging.range2, currency=filters.presentation_currency) }}{{ frappe.utils.fmt_money(aging.range3, currency=filters.presentation_currency) }}{{ frappe.utils.fmt_money(aging.range4, currency=filters.presentation_currency) }}{{ frappe.utils.fmt_money(ageing.range1, currency=filters.presentation_currency) }}{{ frappe.utils.fmt_money(ageing.range2, currency=filters.presentation_currency) }}{{ frappe.utils.fmt_money(ageing.range3, currency=filters.presentation_currency) }}{{ frappe.utils.fmt_money(ageing.range4, currency=filters.presentation_currency) }}
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 01157d6eaf..cf79c03935 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 @@ -94,7 +94,7 @@ def get_report_pdf(doc, consolidated=True): continue html = frappe.render_template(template_path, \ - {"filters": filters, "data": res, "aging": aging[0] if doc.include_ageing else None, + {"filters": filters, "data": res, "ageing": ageing[0] if doc.include_ageing else None, "letter_head": letter_head if doc.letter_head else None, "terms_and_conditions": frappe.db.get_value('Terms and Conditions', doc.terms_and_conditions, 'terms') if doc.terms_and_conditions else None})