From ed34a442a81784e9b47d231d06806750419af511 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Sat, 14 Apr 2018 11:04:00 +0530 Subject: [PATCH] Obey currency filter in financial statement prints #pdd (#13648) --- erpnext/accounts/report/financial_statements.html | 8 ++++---- .../profit_and_loss_statement.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/report/financial_statements.html b/erpnext/accounts/report/financial_statements.html index 07ed9af857..38fa3ce235 100644 --- a/erpnext/accounts/report/financial_statements.html +++ b/erpnext/accounts/report/financial_statements.html @@ -22,9 +22,9 @@

{%= __(report.report_name) %}

{%= filters.company %}

{%= filters.fiscal_year %}

-
{%= __("Currency") %} : {%= erpnext.get_currency(filters.company) %}
+
{%= __("Currency") %} : {%= filters.presentation_currency || erpnext.get_currency(filters.company) %}
{% if (filters.from_date) { %} -

{%= dateutil.str_to_user(filters.from_date) %} - {%= dateutil.str_to_user(filters.to_date) %}

+

{%= frappe.datetime.str_to_user(filters.from_date) %} - {%= frappe.datetime.str_to_user(filters.to_date) %}

{% } %}
@@ -51,7 +51,7 @@ {% } %} @@ -59,4 +59,4 @@ {% } %}
{% var fieldname = report.columns[i].field || report.columns[i].fieldname; %} {% if (!is_null(row[fieldname])) { %} - {%= format_number(row[fieldname], null)%} + {%= format_currency(row[fieldname], filters.presentation_currency) %} {% } %}
-

Printed On {%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}

+

Printed On {%= frappe.datetime.str_to_user(frappe.datetime.get_datetime_as_string()) %}

diff --git a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py index 5b2f5d66d6..c8d9857d54 100644 --- a/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py +++ b/erpnext/accounts/report/profit_and_loss_statement/profit_and_loss_statement.py @@ -19,7 +19,7 @@ def execute(filters=None): accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy= True) - net_profit_loss = get_net_profit_loss(income, expense, period_list, filters.company) + net_profit_loss = get_net_profit_loss(income, expense, period_list, filters.company, filters.presentation_currency) data = [] data.extend(income or []) @@ -33,13 +33,13 @@ def execute(filters=None): return columns, data, None, chart -def get_net_profit_loss(income, expense, period_list, company): +def get_net_profit_loss(income, expense, period_list, company, currency=None): total = 0 net_profit_loss = { "account_name": "'" + _("Profit for the year") + "'", "account": "'" + _("Profit for the year") + "'", "warn_if_negative": True, - "currency": frappe.db.get_value("Company", company, "default_currency") + "currency": currency or frappe.db.get_value("Company", company, "default_currency") } has_value = False