// ERPNext - web based ERP (http://erpnext.com)
// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
// tree of chart of accounts / cost centers
// multiple companies
// add node
// edit node
// see ledger
pscript['onload_Accounts Browser'] = function(wrapper){
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
if (wn.boot.profile.can_create.indexOf("Company") !== -1) {
wrapper.appframe.add_button('New Company', function() { newdoc('Company'); },
'icon-plus');
}
wrapper.appframe.add_button('Refresh', function() {
wrapper.$company_select.change();
}, 'icon-refresh');
// company-select
wrapper.$company_select = $('')
.change(function() {
var ctype = wn.get_route()[1] || 'Account';
erpnext.account_chart = new erpnext.AccountsChart(ctype, $(this).val(), wrapper);
})
.appendTo(wrapper.appframe.$w.find('.appframe-toolbar'));
// load up companies
wn.call({
method:'accounts.page.accounts_browser.accounts_browser.get_companies',
callback: function(r) {
wrapper.$company_select.empty();
$.each(r.message, function(i, v) {
$('