general ledger report group by ledgers

This commit is contained in:
Nabin Hait 2013-01-01 19:52:52 +05:30
parent 6f6fadd360
commit 2f1d1a05b8

View File

@ -104,18 +104,21 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
var me = this; var me = this;
this.accounts_by_company = this.make_accounts_by_company(); this.accounts_by_company = this.make_accounts_by_company();
// filter accounts options by company // filter accounts options by company
this.filter_inputs.company && this.filter_inputs.company.change(function() { this.filter_inputs.company.change(function() {
me.setup_account_filter(this); me.setup_account_filter(this);
me.filter_inputs.refresh.click(); me.filter_inputs.refresh.click();
}); });
this.filter_inputs.account && this.filter_inputs.group_by_ledger this.filter_inputs.account.change(function() {
&& this.filter_inputs.account.change(function() { me.make_account_by_name();
me.make_account_by_name(); me.filter_inputs.group_by_ledger
me.filter_inputs.group_by_ledger.parent() .parent().toggle(!!(me.account_by_name[$(this).val()]
.toggle(!!(me.account_by_name[$(this).val()] && me.account_by_name[$(this).val()].group_or_ledger==="Group")); && me.account_by_name[$(this).val()].group_or_ledger==="Group"));
}); });
this.trigger_refresh_on_change(["group_by_ledger"]);
}, },
setup_account_filter: function(company_filter) { setup_account_filter: function(company_filter) {
var me = this; var me = this;
@ -135,11 +138,13 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
}, },
init_filter_values: function() { init_filter_values: function() {
this._super(); this._super();
this.filter_inputs.group_by_ledger.parent().toggle(false);
this.filter_inputs.company.change(); this.filter_inputs.company.change();
this.filter_inputs.account.change(); this.filter_inputs.account.change();
}, },
apply_filters_from_route: function() { apply_filters_from_route: function() {
this._super(); this._super();
this.filter_inputs.group_by_ledger.parent().toggle(false);
this.filter_inputs.company.change(); this.filter_inputs.company.change();
this.filter_inputs.account.change(); this.filter_inputs.account.change();
}, },
@ -269,10 +274,11 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
out = out.concat([grouped_ledgers[account].opening]) out = out.concat([grouped_ledgers[account].opening])
.concat(grouped_ledgers[account].entries) .concat(grouped_ledgers[account].entries)
.concat([grouped_ledgers[account].totals, .concat([grouped_ledgers[account].totals,
grouped_ledgers[account].closing]); grouped_ledgers[account].closing,
{id: "_blank" + i, _no_format: true, debit: "", credit: ""}]);
} }
}); });
return out; return [{id: "_blank_first", _no_format: true, debit: "", credit: ""}].concat(out);
}, },
make_summary_row: function(label, item_account) { make_summary_row: function(label, item_account) {