Budget variance report based on company

This commit is contained in:
Nabin Hait 2011-08-17 15:03:01 +05:30
parent 07be4c963a
commit 81e36a34a6
3 changed files with 15 additions and 13 deletions

View File

@ -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();

View File

@ -131,11 +131,6 @@ def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
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 @@ for r in res:
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])

View File

@ -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
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