fix: annual income and expenses in digest
diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py
index 7d91309..dbad2ba 100644
--- a/erpnext/accounts/utils.py
+++ b/erpnext/accounts/utils.py
@@ -183,6 +183,7 @@
cost_center=None,
ignore_account_permission=False,
account_type=None,
+ start_date=None,
):
if not account and frappe.form_dict.get("account"):
account = frappe.form_dict.get("account")
@@ -196,6 +197,8 @@
cost_center = frappe.form_dict.get("cost_center")
cond = ["is_cancelled=0"]
+ if start_date:
+ cond.append("posting_date >= %s" % frappe.db.escape(cstr(start_date)))
if date:
cond.append("posting_date <= %s" % frappe.db.escape(cstr(date)))
else:
diff --git a/erpnext/setup/doctype/email_digest/email_digest.py b/erpnext/setup/doctype/email_digest/email_digest.py
index 4fc20e6..b9e2257 100644
--- a/erpnext/setup/doctype/email_digest/email_digest.py
+++ b/erpnext/setup/doctype/email_digest/email_digest.py
@@ -382,9 +382,10 @@
"""Get income to date"""
balance = 0.0
count = 0
+ fy_start_date = get_fiscal_year().get("year_start_date")
for account in self.get_root_type_accounts(root_type):
- balance += get_balance_on(account, date=self.future_to_date)
+ balance += get_balance_on(account, date=self.future_to_date, start_date=fy_start_date)
count += get_count_on(account, fieldname, date=self.future_to_date)
if fieldname == "income":