Cleanup on financial statement PR
This commit is contained in:
parent
39bcb3de4b
commit
d5d8db7a3f
@ -8,14 +8,23 @@ from frappe.utils import flt, cint
|
|||||||
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
|
from erpnext.accounts.report.financial_statements import (get_period_list, get_columns, get_data)
|
||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity, filters.accumulated_values)
|
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year,
|
||||||
|
filters.periodicity, filters.accumulated_values, filters.company)
|
||||||
|
|
||||||
asset = get_data(filters.company, "Asset", "Debit", period_list, only_current_fiscal_year=False, filters=filters,
|
asset = get_data(filters.company, "Asset", "Debit", period_list,
|
||||||
accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy=True)
|
only_current_fiscal_year=False, filters=filters,
|
||||||
liability = get_data(filters.company, "Liability", "Credit", period_list, only_current_fiscal_year=False, filters=filters,
|
accumulated_values=filters.accumulated_values,
|
||||||
accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy=True)
|
ignore_closing_entries=True, ignore_accumulated_values_for_fy=True)
|
||||||
equity = get_data(filters.company, "Equity", "Credit", period_list, only_current_fiscal_year=False, filters=filters,
|
|
||||||
accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy=True)
|
liability = get_data(filters.company, "Liability", "Credit", period_list,
|
||||||
|
only_current_fiscal_year=False, filters=filters,
|
||||||
|
accumulated_values=filters.accumulated_values,
|
||||||
|
ignore_closing_entries=True, ignore_accumulated_values_for_fy=True)
|
||||||
|
|
||||||
|
equity = get_data(filters.company, "Equity", "Credit", period_list,
|
||||||
|
only_current_fiscal_year=False, filters=filters,
|
||||||
|
accumulated_values=filters.accumulated_values,
|
||||||
|
ignore_closing_entries=True, ignore_accumulated_values_for_fy=True)
|
||||||
|
|
||||||
provisional_profit_loss, total_credit = get_provisional_profit_loss(asset, liability, equity,
|
provisional_profit_loss, total_credit = get_provisional_profit_loss(asset, liability, equity,
|
||||||
period_list, filters.company)
|
period_list, filters.company)
|
||||||
|
@ -10,7 +10,8 @@ from erpnext.accounts.utils import get_fiscal_year
|
|||||||
|
|
||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity, filters.accumulated_values)
|
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year,
|
||||||
|
filters.periodicity, filters.accumulated_values, filters.company)
|
||||||
|
|
||||||
operation_accounts = {
|
operation_accounts = {
|
||||||
"section_name": "Operations",
|
"section_name": "Operations",
|
||||||
@ -103,7 +104,7 @@ def get_account_type_based_data(company, account_type, period_list, accumulated_
|
|||||||
data = {}
|
data = {}
|
||||||
total = 0
|
total = 0
|
||||||
for period in period_list:
|
for period in period_list:
|
||||||
start_date = get_start_date(period, accumulated_values)
|
start_date = get_start_date(period, accumulated_values, company)
|
||||||
gl_sum = frappe.db.sql_list("""
|
gl_sum = frappe.db.sql_list("""
|
||||||
select sum(credit) - sum(debit)
|
select sum(credit) - sum(debit)
|
||||||
from `tabGL Entry`
|
from `tabGL Entry`
|
||||||
|
@ -143,7 +143,8 @@ def calculate_values(accounts_by_name, gl_entries_by_account, period_list, accum
|
|||||||
|
|
||||||
if entry.posting_date <= period.to_date:
|
if entry.posting_date <= period.to_date:
|
||||||
if (accumulated_values or entry.posting_date >= period.from_date) and \
|
if (accumulated_values or entry.posting_date >= period.from_date) and \
|
||||||
(not ignore_accumulated_values_for_fy or entry.fiscal_year == period.to_date_fiscal_year):
|
(not ignore_accumulated_values_for_fy or
|
||||||
|
entry.fiscal_year == period.to_date_fiscal_year):
|
||||||
d[period.key] = d.get(period.key, 0.0) + flt(entry.debit) - flt(entry.credit)
|
d[period.key] = d.get(period.key, 0.0) + flt(entry.debit) - flt(entry.credit)
|
||||||
|
|
||||||
if entry.posting_date < period_list[0].year_start_date:
|
if entry.posting_date < period_list[0].year_start_date:
|
||||||
|
@ -12,9 +12,12 @@ def execute(filters=None):
|
|||||||
filters.periodicity, filters.accumulated_values, filters.company)
|
filters.periodicity, filters.accumulated_values, filters.company)
|
||||||
|
|
||||||
income = get_data(filters.company, "Income", "Credit", period_list, filters = filters,
|
income = get_data(filters.company, "Income", "Credit", period_list, filters = filters,
|
||||||
accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
|
accumulated_values=filters.accumulated_values,
|
||||||
|
ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
|
||||||
|
|
||||||
expense = get_data(filters.company, "Expense", "Debit", period_list, filters=filters,
|
expense = get_data(filters.company, "Expense", "Debit", period_list, filters=filters,
|
||||||
accumulated_values=filters.accumulated_values, ignore_closing_entries=True, ignore_accumulated_values_for_fy= True)
|
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)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user