Update profit_and_loss_statement.py
This commit is contained in:
parent
b428e4c493
commit
d65e050f4b
@ -32,12 +32,12 @@ def execute(filters=None):
|
|||||||
|
|
||||||
chart = get_chart_data(filters, columns, income, expense, net_profit_loss)
|
chart = get_chart_data(filters, columns, income, expense, net_profit_loss)
|
||||||
|
|
||||||
default_currency = filters.presentation_currency or frappe.get_cached_value('Company', filters.company, "default_currency")
|
currency = filters.presentation_currency or frappe.get_cached_value('Company', filters.company, "default_currency")
|
||||||
report_summary = get_report_summary(period_list, filters.periodicity, income, expense, net_profit_loss, default_currency)
|
report_summary = get_report_summary(period_list, filters.periodicity, income, expense, net_profit_loss, currency)
|
||||||
|
|
||||||
return columns, data, None, chart, report_summary
|
return columns, data, None, chart, report_summary
|
||||||
|
|
||||||
def get_report_summary(period_list, periodicity, income, expense, net_profit_loss, default_currency, consolidated=False):
|
def get_report_summary(period_list, periodicity, income, expense, net_profit_loss, currency, consolidated=False):
|
||||||
net_income, net_expense, net_profit = 0.0, 0.0, 0.0
|
net_income, net_expense, net_profit = 0.0, 0.0, 0.0
|
||||||
|
|
||||||
for period in period_list:
|
for period in period_list:
|
||||||
@ -64,19 +64,19 @@ def get_report_summary(period_list, periodicity, income, expense, net_profit_los
|
|||||||
"indicator": "Green" if net_profit > 0 else "Red",
|
"indicator": "Green" if net_profit > 0 else "Red",
|
||||||
"label": profit_label,
|
"label": profit_label,
|
||||||
"datatype": "Currency",
|
"datatype": "Currency",
|
||||||
"currency": default_currency
|
"currency": currency
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"value": net_income,
|
"value": net_income,
|
||||||
"label": income_label,
|
"label": income_label,
|
||||||
"datatype": "Currency",
|
"datatype": "Currency",
|
||||||
"currency": default_currency
|
"currency": currency
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"value": net_expense,
|
"value": net_expense,
|
||||||
"label": expense_label,
|
"label": expense_label,
|
||||||
"datatype": "Currency",
|
"datatype": "Currency",
|
||||||
"currency": default_currency
|
"currency": currency
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -143,4 +143,4 @@ def get_chart_data(filters, columns, income, expense, net_profit_loss):
|
|||||||
|
|
||||||
chart["fieldtype"] = "Currency"
|
chart["fieldtype"] = "Currency"
|
||||||
|
|
||||||
return chart
|
return chart
|
||||||
|
Loading…
Reference in New Issue
Block a user