trial balance, export ledgers only and groups only

This commit is contained in:
Rushabh Mehta 2012-11-13 13:28:26 +05:30
parent 724bb471ee
commit c68fc3f3d7
3 changed files with 42 additions and 3 deletions

View File

@ -22,5 +22,39 @@ wn.pages['trial-balance'].onload = function(wrapper) {
title: 'Trial Balance', title: 'Trial Balance',
single_column: true single_column: true
}); });
erpnext.trial_balance = new erpnext.AccountTreeGrid(wrapper, 'Trial Balance'); var TrialBalance = erpnext.AccountTreeGrid.extend({
export: function() {
var msgbox = msgprint('<p>Select To Download:</p>\
<p><input type="checkbox" name="with_groups" checked> Account Groups</p>\
<p><input type="checkbox" name="with_ledgers" checked> Account Ledgers</p>\
<p><button class="btn btn-info btn-small">Download</button>');
var me = this;
$(msgbox.body).find("button").click(function() {
var with_groups = $(msgbox.body).find("[name='with_groups']").is(":checked");
var with_ledgers = $(msgbox.body).find("[name='with_ledgers']").is(":checked");
var data = wn.slickgrid_tools.get_view_data(me.columns, me.dataView,
function(row, item) {
if(with_groups) {
// pad row
for(var i=0; i<item.indent; i++) row[0] = " " + row[0];
}
if(with_groups && item.group_or_ledger == "Group") return true;
if(with_ledgers && item.group_or_ledger == "Ledger") return true;
return false;
});
console.log(data);
wn.downloadify(data, ["Report Manager", "System Manager"], me);
return false;
})
return false;
},
})
erpnext.trial_balance = new TrialBalance(wrapper, 'Trial Balance');
} }

View File

@ -1,5 +1,6 @@
erpnext.updates = [ erpnext.updates = [
["13th November 2012", [ ["13th November 2012", [
"Trial Balance (new): Feature to export Ledgers or Groups selectively. Indent Groups with spaces",
"General Ledger (new): Will show entries with 'Is Opening' as Opening.", "General Ledger (new): Will show entries with 'Is Opening' as Opening.",
"General Ledger (new): Show against account entries if filtered by account.", "General Ledger (new): Show against account entries if filtered by account.",
]], ]],

View File

@ -33,9 +33,13 @@ data_map = {
# Accounts # Accounts
"Account": { "Account": {
"columns": ["name", "parent_account", "lft", "rgt", "debit_or_credit", "columns": ["name", "parent_account", "lft", "rgt", "debit_or_credit",
"is_pl_account", "company"], "is_pl_account", "company", "group_or_ledger"],
"conditions": ["docstatus < 2"], "conditions": ["docstatus < 2"],
"order_by": "lft" "order_by": "lft",
"links": {
"company": ["Company", "name"],
}
}, },
"Cost Center": { "Cost Center": {
"columns": ["name", "lft", "rgt"], "columns": ["name", "lft", "rgt"],