Budget variance report based on company
diff --git a/accounts/search_criteria/budget_variance_report/budget_variance_report.js b/accounts/search_criteria/budget_variance_report/budget_variance_report.js
index ed5adb1..08c9693 100644
--- a/accounts/search_criteria/budget_variance_report/budget_variance_report.js
+++ b/accounts/search_criteria/budget_variance_report/budget_variance_report.js
@@ -1,17 +1,15 @@
report.customize_filters = function() {
-
- //this.hide_all_filters();
- this.mytabs.items['Select Columns'].hide();
- this.mytabs.items['More Filters'].hide();
-
-
this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Budget Detail'});
+ this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'Budget Detail', in_first_page:1});
this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Fiscal Year'].df.in_first_page = 1;
this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Period'].df.in_first_page = 1;
this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
}
+
report.aftertableprint = function(t) {
$yt(t,'*',1,{whiteSpace:'pre'});
}
+
+this.mytabs.items['More Filters'].hide();
this.mytabs.items['Select Columns'].hide();
diff --git a/accounts/search_criteria/budget_variance_report/budget_variance_report.py b/accounts/search_criteria/budget_variance_report/budget_variance_report.py
index 182f9e5..9f7c690 100644
--- a/accounts/search_criteria/budget_variance_report/budget_variance_report.py
+++ b/accounts/search_criteria/budget_variance_report/budget_variance_report.py
@@ -131,11 +131,6 @@
col_idx[str(c) + n ] = len(colnames) - 1
-
-# make default columns
-#coltypes[col_idx[based_on]] = 'Link'
-#coloptions[col_idx[based_on]]= based_on
-
# get start date
start_date = get_value('Fiscal Year', fiscal_year, 'year_start_date')
if not start_date:
@@ -162,7 +157,7 @@
ch = make_child_lst(based_on,r[0].strip())
- actual = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 where t2.is_pl_account = 'Yes' and t1.is_cancelled = 'No' and t1.cost_center in %s and t2.debit_or_credit = 'Debit' and t1.posting_date between '%s' and '%s' and t1.account = t2.name"%(ch, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
+ actual = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 where ifnull(t2.is_pl_account, 'No') = 'Yes' and ifnull(t1.is_cancelled, 'No') = 'No' and t1.cost_center in %s and t2.debit_or_credit = 'Debit' and t1.posting_date between '%s' and '%s' and t1.account = t2.name"%(ch, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
#----------------------------------------------------------
actual = flt(actual[0][0])
diff --git a/accounts/search_criteria/budget_variance_report/budget_variance_report.sql b/accounts/search_criteria/budget_variance_report/budget_variance_report.sql
index d53f7e1..575fbfb 100644
--- a/accounts/search_criteria/budget_variance_report/budget_variance_report.sql
+++ b/accounts/search_criteria/budget_variance_report/budget_variance_report.sql
@@ -1 +1,10 @@
-SELECT CONCAT(REPEAT(' ', COUNT(parent.name) - 1), node.name) AS name FROM `tabCost Center` AS node,`tabCost Center` AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt AND node.docstatus !=2 GROUP BY node.name ORDER BY node.lft
\ No newline at end of file
+SELECT
+ CONCAT(REPEAT(' ', COUNT(parent.name) - 1), node.name) AS name
+FROM
+ `tabCost Center` AS node,`tabCost Center` AS parent
+WHERE
+ node.lft BETWEEN parent.lft AND parent.rgt
+ AND node.docstatus !=2
+ AND node.company_name like '%(company)s%%'
+GROUP BY node.name
+ORDER BY node.lft