From afceac620c757d506fcd6f81cbd4dc7d8c3968e1 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Wed, 19 Oct 2016 12:49:37 +0530 Subject: [PATCH] [fix] calculate variance only for submitted budgets --- .../report/budget_variance_report/budget_variance_report.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py index b67e2b6ec4..0be0b3d9a9 100644 --- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py +++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py @@ -64,7 +64,7 @@ def get_cost_center_target_details(filters): return frappe.db.sql(""" select b.cost_center, b.monthly_distribution, ba.account, ba.budget_amount from `tabBudget` b, `tabBudget Account` ba - where b.name=ba.parent and b.fiscal_year=%s and b.company=%s + where b.name=ba.parent and b.docstatus = 1 and b.fiscal_year=%s and b.company=%s """, (filters.fiscal_year, filters.company), as_dict=True) #Get target distribution details of accounts of cost center @@ -84,8 +84,9 @@ def get_actual_details(cost_center, fiscal_year): ac_details = frappe.db.sql("""select gl.account, gl.debit, gl.credit, MONTHNAME(gl.posting_date) as month_name, b.cost_center from `tabGL Entry` gl, `tabBudget Account` ba, `tabBudget` b - where + where b.name = ba.parent + and b.docstatus = 1 and ba.account=gl.account and gl.fiscal_year=%s and b.cost_center=%s