Update profit_and_loss_statement.py
This commit is contained in:
parent
539a826b37
commit
1f51e71827
@ -10,8 +10,8 @@ from erpnext.accounts.report.financial_statements import (get_period_list, get_c
|
||||
def execute(filters=None):
|
||||
period_list = get_period_list(filters.fiscal_year, filters.periodicity)
|
||||
|
||||
income = get_data(filters.company, "Income", "Credit", period_list, ignore_closing_entries=True)
|
||||
expense = get_data(filters.company, "Expense", "Debit", period_list, ignore_closing_entries=True)
|
||||
income = get_data(filters.company, "Income", "Credit", period_list, filters.accumulated_value, ignore_closing_entries=True)
|
||||
expense = get_data(filters.company, "Expense", "Debit", period_list, filters.accumulated_value, ignore_closing_entries=True)
|
||||
net_profit_loss = get_net_profit_loss(income, expense, period_list, filters.company)
|
||||
|
||||
data = []
|
||||
@ -20,7 +20,7 @@ def execute(filters=None):
|
||||
if net_profit_loss:
|
||||
data.append(net_profit_loss)
|
||||
|
||||
columns = get_columns(period_list, filters.company)
|
||||
columns = get_columns(filters.periodicity,period_list,filters.accumulated_value)
|
||||
|
||||
return columns, data
|
||||
|
||||
@ -33,7 +33,17 @@ def get_net_profit_loss(income, expense, period_list, company):
|
||||
"currency": frappe.db.get_value("Company", company, "default_currency")
|
||||
}
|
||||
|
||||
has_value = False
|
||||
|
||||
for period in period_list:
|
||||
net_profit_loss[period.key] = flt(income[-2][period.key] - expense[-2][period.key], 3)
|
||||
|
||||
if net_profit_loss[period.key]:
|
||||
has_value=True
|
||||
|
||||
total_column=total_column+net_profit_loss[period.key]
|
||||
net_profit_loss["total"]=total_column
|
||||
|
||||
if has_value:
|
||||
|
||||
return net_profit_loss
|
||||
return net_profit_loss
|
||||
|
Loading…
Reference in New Issue
Block a user