[general ledger] group by voucher

This commit is contained in:
Nabin Hait 2013-06-24 13:54:16 +05:30
parent 55d0ec36ac
commit 8b96ba1da6
2 changed files with 13 additions and 23 deletions

View File

@ -63,15 +63,6 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
open_btn: true,
doctype: "dataContext.voucher_type"
}},
{id: "against_voucher_type", name: "Against Voucher Type",
field: "against_voucher_type", width: 120},
{id: "against_voucher", name: "Against Voucher",
field: "against_voucher", width: 160,
link_formatter: {
filter_input: "against_voucher",
open_btn: true,
doctype: "dataContext.against_voucher_type"
}},
{id: "remarks", name: "Remarks", field: "remarks", width: 200,
formatter: this.text_formatter},
@ -224,8 +215,8 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
if(!grouped_ledgers[item.account].entries_group_by_voucher[item.voucher_no]) {
grouped_ledgers[item.account].entries_group_by_voucher[item.voucher_no] = {
entries: [],
totals: me.make_summary_row("Totals", item.voucher_no)
row: {},
totals: {"debit": 0, "credit": 0}
}
}
@ -256,8 +247,10 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
out.push(item);
grouped_ledgers[item.account].entries.push(item);
grouped_ledgers[item.account].entries_group_by_voucher[item.voucher_no]
.entries.push(item);
if(grouped_ledgers[item.account].entries_group_by_voucher[item.voucher_no].row){
grouped_ledgers[item.account].
entries_group_by_voucher[item.voucher_no].row = item;
}
}
}
});
@ -329,14 +322,12 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
if(grouped_ledgers[account].entries.length) {
$.each(Object.keys(grouped_ledgers[account].entries_group_by_voucher).sort(),
function(j, voucher) {
if(grouped_ledgers[account].entries_group_by_voucher[voucher]
.entries.length) {
out = out.concat(grouped_ledgers[account]
.entries_group_by_voucher[voucher].entries)
.concat([
grouped_ledgers[account].entries_group_by_voucher[voucher]
.totals, {id: "_blank" + j, _no_format: true,
debit: "", credit: ""}]);
voucher_dict = grouped_ledgers[account].entries_group_by_voucher[voucher];
if(voucher_dict.totals.debit || voucher_dict.totals.credit) {
voucher_dict.row.debit = voucher_dict.totals.debit;
voucher_dict.row.credit = voucher_dict.totals.credit;
voucher_dict.row.id = "entry" + voucher
out = out.concat(voucher_dict.row);
}
});
}

View File

@ -48,8 +48,7 @@ data_map = {
},
"GL Entry": {
"columns": ["name", "account", "posting_date", "cost_center", "debit", "credit",
"is_opening", "company", "voucher_type", "voucher_no", "remarks",
"against_voucher_type", "against_voucher"],
"is_opening", "company", "voucher_type", "voucher_no", "remarks"],
"conditions": ["ifnull(is_cancelled, 'No')='No'"],
"order_by": "posting_date, account",
"links": {