mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-29 18:04:46 +00:00
@@ -157,7 +157,8 @@ wn.module_page["Accounts"] = [
|
||||
items: [
|
||||
{
|
||||
"label":wn._("General Ledger"),
|
||||
page: "general-ledger"
|
||||
doctype: "GL Entry",
|
||||
route: "query-report/General Ledger"
|
||||
},
|
||||
{
|
||||
"label":wn._("Trial Balance"),
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
General Ledger report (for all transactions and accounts).
|
||||
@@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
@@ -1,396 +0,0 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
wn.pages['general-ledger'].onload = function(wrapper) {
|
||||
wn.ui.make_app_page({
|
||||
parent: wrapper,
|
||||
title: wn._('General Ledger'),
|
||||
single_column: true
|
||||
});
|
||||
|
||||
erpnext.general_ledger = new erpnext.GeneralLedger(wrapper);
|
||||
wrapper.appframe.add_module_icon("Accounts")
|
||||
|
||||
}
|
||||
|
||||
erpnext.GeneralLedger = wn.views.GridReport.extend({
|
||||
init: function(wrapper) {
|
||||
this._super({
|
||||
title: wn._("General Ledger"),
|
||||
page: wrapper,
|
||||
parent: $(wrapper).find('.layout-main'),
|
||||
appframe: wrapper.appframe,
|
||||
doctypes: ["Company", "Account", "GL Entry", "Cost Center"],
|
||||
});
|
||||
},
|
||||
setup_columns: function() {
|
||||
this.columns = [
|
||||
{id: "posting_date", name: wn._("Posting Date"), field: "posting_date", width: 100,
|
||||
formatter: this.date_formatter},
|
||||
{id: "account", name: wn._("Account"), field: "account", width: 240,
|
||||
link_formatter: {
|
||||
filter_input: "account",
|
||||
open_btn: true,
|
||||
doctype: "'Account'"
|
||||
}},
|
||||
{id: "against_account", name: wn._("Against Account"), field: "against_account",
|
||||
width: 240, hidden: !this.account},
|
||||
|
||||
{id: "debit", name: wn._("Debit"), field: "debit", width: 100,
|
||||
formatter: this.currency_formatter},
|
||||
{id: "credit", name: wn._("Credit"), field: "credit", width: 100,
|
||||
formatter: this.currency_formatter},
|
||||
{id: "voucher_type", name: wn._("Voucher Type"), field: "voucher_type", width: 120},
|
||||
{id: "voucher_no", name: wn._("Voucher No"), field: "voucher_no", width: 160,
|
||||
link_formatter: {
|
||||
filter_input: "voucher_no",
|
||||
open_btn: true,
|
||||
doctype: "dataContext.voucher_type"
|
||||
}},
|
||||
{id: "remarks", name: wn._("Remarks"), field: "remarks", width: 200,
|
||||
formatter: this.text_formatter},
|
||||
|
||||
];
|
||||
},
|
||||
|
||||
filters: [
|
||||
{fieldtype:"Select", label: wn._("Company"), link:"Company", default_value: wn._("Select Company..."),
|
||||
filter: function(val, item, opts) {
|
||||
return item.company == val || val == opts.default_value;
|
||||
}},
|
||||
{fieldtype:"Link", label: wn._("Account"), link:"Account",
|
||||
filter: function(val, item, opts, me) {
|
||||
if(!val) {
|
||||
return true;
|
||||
} else {
|
||||
// true if GL Entry belongs to selected
|
||||
// account ledger or group
|
||||
return me.is_child_account(val, item.account);
|
||||
}
|
||||
}},
|
||||
{fieldtype:"Data", label: wn._("Voucher No"),
|
||||
filter: function(val, item, opts) {
|
||||
if(!val) return true;
|
||||
return (item.voucher_no && item.voucher_no.indexOf(val)!=-1);
|
||||
}},
|
||||
{fieldtype:"Date", label: wn._("From Date"), filter: function(val, item) {
|
||||
return dateutil.str_to_obj(val) <= dateutil.str_to_obj(item.posting_date);
|
||||
}},
|
||||
{fieldtype:"Label", label: wn._("To")},
|
||||
{fieldtype:"Date", label: wn._("To Date"), filter: function(val, item) {
|
||||
return dateutil.str_to_obj(val) >= dateutil.str_to_obj(item.posting_date);
|
||||
}},
|
||||
{fieldtype: "Check", label: wn._("Group by Ledger")},
|
||||
{fieldtype: "Check", label: wn._("Group by Voucher")},
|
||||
{fieldtype:"Button", label: wn._("Refresh"), icon:"icon-refresh icon-white"},
|
||||
{fieldtype:"Button", label: wn._("Reset Filters")}
|
||||
],
|
||||
setup_filters: function() {
|
||||
this._super();
|
||||
var me = this;
|
||||
|
||||
this.accounts_by_company = this.make_accounts_by_company();
|
||||
|
||||
// filter accounts options by company
|
||||
this.filter_inputs.company.on("change", function() {
|
||||
me.setup_account_filter(this);
|
||||
me.refresh();
|
||||
});
|
||||
|
||||
this.trigger_refresh_on_change(["group_by_ledger", "group_by_voucher"]);
|
||||
},
|
||||
setup_account_filter: function(company_filter) {
|
||||
var me = this;
|
||||
|
||||
var $account = me.filter_inputs.account;
|
||||
var company = $(company_filter).val();
|
||||
var default_company = this.filter_inputs.company.get(0).opts.default_value;
|
||||
var opts = $account.get(0).opts;
|
||||
opts.list = $.map(wn.report_dump.data["Account"], function(ac) {
|
||||
return (company===default_company ||
|
||||
me.accounts_by_company[company].indexOf(ac.name)!=-1) ?
|
||||
ac.name : null;
|
||||
});
|
||||
|
||||
this.set_autocomplete($account, opts.list);
|
||||
|
||||
},
|
||||
init_filter_values: function() {
|
||||
this._super();
|
||||
this.toggle_group_by_checks();
|
||||
this.filter_inputs.company.trigger("change");
|
||||
},
|
||||
apply_filters_from_route: function() {
|
||||
this._super();
|
||||
this.toggle_group_by_checks();
|
||||
},
|
||||
make_accounts_by_company: function() {
|
||||
var accounts_by_company = {};
|
||||
var me = this;
|
||||
$.each(wn.report_dump.data["Account"], function(i, ac) {
|
||||
if(!accounts_by_company[ac.company]) accounts_by_company[ac.company] = [];
|
||||
accounts_by_company[ac.company].push(ac.name);
|
||||
});
|
||||
return accounts_by_company;
|
||||
},
|
||||
is_child_account: function(account, item_account) {
|
||||
account = this.account_by_name[account];
|
||||
item_account = this.account_by_name[item_account];
|
||||
return ((item_account.lft >= account.lft) && (item_account.rgt <= account.rgt));
|
||||
},
|
||||
toggle_group_by_checks: function() {
|
||||
this.make_account_by_name();
|
||||
|
||||
// this.filter_inputs.group_by_ledger
|
||||
// .parent().toggle(!!(this.account_by_name[this.account]
|
||||
// && this.account_by_name[this.account].group_or_ledger==="Group"));
|
||||
//
|
||||
// this.filter_inputs.group_by_voucher
|
||||
// .parent().toggle(!!(this.account_by_name[this.account]
|
||||
// && this.account_by_name[this.account].group_or_ledger==="Ledger"));
|
||||
},
|
||||
prepare_data: function() {
|
||||
var me = this;
|
||||
var data = wn.report_dump.data["GL Entry"];
|
||||
var out = [];
|
||||
|
||||
this.toggle_group_by_checks();
|
||||
|
||||
var from_date = dateutil.str_to_obj(this.from_date);
|
||||
var to_date = dateutil.str_to_obj(this.to_date);
|
||||
|
||||
if(to_date < from_date) {
|
||||
msgprint(wn._("From Date must be before To Date"));
|
||||
return;
|
||||
}
|
||||
|
||||
// add Opening, Closing, Totals rows
|
||||
// if filtered by account and / or voucher
|
||||
var opening = this.make_summary_row("Opening", this.account);
|
||||
var totals = this.make_summary_row("Totals", this.account);
|
||||
|
||||
var grouped_ledgers = {};
|
||||
$.each(data, function(i, item) {
|
||||
if(me.apply_filter(item, "company") &&
|
||||
(me.account ? me.is_child_account(me.account, item.account)
|
||||
: true) && (me.voucher_no ? item.voucher_no==me.voucher_no : true)) {
|
||||
var date = dateutil.str_to_obj(item.posting_date);
|
||||
|
||||
// create grouping by ledger
|
||||
if(!grouped_ledgers[item.account]) {
|
||||
grouped_ledgers[item.account] = {
|
||||
entries: [],
|
||||
entries_group_by_voucher: {},
|
||||
opening: me.make_summary_row("Opening", item.account),
|
||||
totals: me.make_summary_row("Totals", item.account),
|
||||
closing: me.make_summary_row("Closing (Opening + Totals)",
|
||||
item.account)
|
||||
};
|
||||
}
|
||||
|
||||
if(!grouped_ledgers[item.account].entries_group_by_voucher[item.voucher_no]) {
|
||||
grouped_ledgers[item.account].entries_group_by_voucher[item.voucher_no] = {
|
||||
row: {},
|
||||
totals: {"debit": 0, "credit": 0}
|
||||
}
|
||||
}
|
||||
|
||||
if(!me.voucher_no && (date < from_date || item.is_opening=="Yes")) {
|
||||
opening.debit += item.debit;
|
||||
opening.credit += item.credit;
|
||||
|
||||
grouped_ledgers[item.account].opening.debit += item.debit;
|
||||
grouped_ledgers[item.account].opening.credit += item.credit;
|
||||
|
||||
} else if(date <= to_date) {
|
||||
|
||||
totals.debit += item.debit;
|
||||
totals.credit += item.credit;
|
||||
|
||||
grouped_ledgers[item.account].totals.debit += item.debit;
|
||||
grouped_ledgers[item.account].totals.credit += item.credit;
|
||||
grouped_ledgers[item.account].entries_group_by_voucher[item.voucher_no]
|
||||
.totals.debit += item.debit;
|
||||
grouped_ledgers[item.account].entries_group_by_voucher[item.voucher_no]
|
||||
.totals.credit += item.credit;
|
||||
}
|
||||
if(item.account) {
|
||||
item.against_account = me.voucher_accounts[item.voucher_type + ":"
|
||||
+ item.voucher_no][(item.debit > 0 ? "credits" : "debits")].join(", ");
|
||||
}
|
||||
|
||||
if(me.apply_filters(item) && (me.voucher_no || item.is_opening=="No")) {
|
||||
out.push(item);
|
||||
grouped_ledgers[item.account].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 = $.extend({}, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var closing = this.make_summary_row("Closing (Opening + Totals)", this.account);
|
||||
closing.debit = opening.debit + totals.debit;
|
||||
closing.credit = opening.credit + totals.credit;
|
||||
|
||||
if(me.account) {
|
||||
me.appframe.set_title(wn._("General Ledger: ") + me.account);
|
||||
|
||||
// group by ledgers
|
||||
if(this.account_by_name[this.account].group_or_ledger==="Group"
|
||||
&& this.group_by_ledger) {
|
||||
out = this.group_data_by_ledger(grouped_ledgers);
|
||||
}
|
||||
|
||||
if(this.account_by_name[this.account].group_or_ledger==="Ledger"
|
||||
&& this.group_by_voucher) {
|
||||
out = this.group_data_by_voucher(grouped_ledgers);
|
||||
}
|
||||
|
||||
opening = me.get_balance(me.account_by_name[me.account].debit_or_credit, opening)
|
||||
closing = me.get_balance(me.account_by_name[me.account].debit_or_credit, closing)
|
||||
|
||||
out = [opening].concat(out).concat([totals, closing]);
|
||||
} else {
|
||||
me.appframe.set_title(wn._("General Ledger"));
|
||||
out = out.concat([totals]);
|
||||
}
|
||||
|
||||
this.data = out;
|
||||
},
|
||||
|
||||
group_data_by_ledger: function(grouped_ledgers) {
|
||||
var me = this;
|
||||
var out = []
|
||||
$.each(Object.keys(grouped_ledgers).sort(), function(i, account) {
|
||||
if(grouped_ledgers[account].entries.length) {
|
||||
grouped_ledgers[account].closing.debit =
|
||||
grouped_ledgers[account].opening.debit
|
||||
+ grouped_ledgers[account].totals.debit;
|
||||
|
||||
grouped_ledgers[account].closing.credit =
|
||||
grouped_ledgers[account].opening.credit
|
||||
+ grouped_ledgers[account].totals.credit;
|
||||
|
||||
grouped_ledgers[account].opening =
|
||||
me.get_balance(me.account_by_name[me.account].debit_or_credit,
|
||||
grouped_ledgers[account].opening)
|
||||
grouped_ledgers[account].closing =
|
||||
me.get_balance(me.account_by_name[me.account].debit_or_credit,
|
||||
grouped_ledgers[account].closing)
|
||||
|
||||
out = out.concat([grouped_ledgers[account].opening])
|
||||
.concat(grouped_ledgers[account].entries)
|
||||
.concat([grouped_ledgers[account].totals,
|
||||
grouped_ledgers[account].closing,
|
||||
{id: "_blank" + i, debit: "", credit: ""}]);
|
||||
}
|
||||
});
|
||||
return [{id: "_blank_first", debit: "", credit: ""}].concat(out);
|
||||
},
|
||||
|
||||
group_data_by_voucher: function(grouped_ledgers) {
|
||||
var me = this;
|
||||
var out = []
|
||||
$.each(Object.keys(grouped_ledgers).sort(), function(i, account) {
|
||||
if(grouped_ledgers[account].entries.length) {
|
||||
$.each(Object.keys(grouped_ledgers[account].entries_group_by_voucher),
|
||||
function(j, voucher) {
|
||||
voucher_dict = grouped_ledgers[account].entries_group_by_voucher[voucher];
|
||||
if(voucher_dict &&
|
||||
(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_grouped_by_" + voucher
|
||||
out = out.concat(voucher_dict.row);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return out;
|
||||
},
|
||||
|
||||
get_balance: function(debit_or_credit, balance) {
|
||||
if(debit_or_credit == "Debit") {
|
||||
balance.debit -= balance.credit; balance.credit = 0;
|
||||
} else {
|
||||
balance.credit -= balance.debit; balance.debit = 0;
|
||||
}
|
||||
return balance
|
||||
},
|
||||
|
||||
make_summary_row: function(label, item_account) {
|
||||
return {
|
||||
account: label,
|
||||
debit: 0.0,
|
||||
credit: 0.0,
|
||||
id: ["", label, item_account].join("_").replace(" ", "_").toLowerCase(),
|
||||
_show: true,
|
||||
_style: "font-weight: bold"
|
||||
}
|
||||
},
|
||||
|
||||
make_account_by_name: function() {
|
||||
this.account_by_name = this.make_name_map(wn.report_dump.data["Account"]);
|
||||
this.make_voucher_accounts_map();
|
||||
},
|
||||
|
||||
make_voucher_accounts_map: function() {
|
||||
this.voucher_accounts = {};
|
||||
var data = wn.report_dump.data["GL Entry"];
|
||||
for(var i=0, j=data.length; i<j; i++) {
|
||||
var gl = data[i];
|
||||
|
||||
if(!this.voucher_accounts[gl.voucher_type + ":" + gl.voucher_no])
|
||||
this.voucher_accounts[gl.voucher_type + ":" + gl.voucher_no] = {
|
||||
debits: [],
|
||||
credits: []
|
||||
}
|
||||
|
||||
var va = this.voucher_accounts[gl.voucher_type + ":" + gl.voucher_no];
|
||||
if(gl.debit > 0) {
|
||||
va.debits.push(gl.account);
|
||||
} else {
|
||||
va.credits.push(gl.account);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
get_plot_data: function() {
|
||||
var data = [];
|
||||
var me = this;
|
||||
if(!me.account || me.voucher_no) return false;
|
||||
var debit_or_credit = me.account_by_name[me.account].debit_or_credit;
|
||||
var balance = debit_or_credit=="Debit" ? me.data[0].debit : me.data[0].credit;
|
||||
data.push({
|
||||
label: me.account,
|
||||
data: [[dateutil.str_to_obj(me.from_date).getTime(), balance]]
|
||||
.concat($.map(me.data, function(col, idx) {
|
||||
if (col.posting_date) {
|
||||
var diff = (debit_or_credit == "Debit" ? 1 : -1) * (flt(col.debit) - flt(col.credit));
|
||||
balance += diff;
|
||||
return [[dateutil.str_to_obj(col.posting_date).getTime(), balance - diff],
|
||||
[dateutil.str_to_obj(col.posting_date).getTime(), balance]]
|
||||
}
|
||||
return null;
|
||||
})).concat([
|
||||
// closing
|
||||
[dateutil.str_to_obj(me.to_date).getTime(), balance]
|
||||
]),
|
||||
points: {show: true},
|
||||
lines: {show: true, fill: true},
|
||||
});
|
||||
return data;
|
||||
},
|
||||
get_plot_options: function() {
|
||||
return {
|
||||
grid: { hoverable: true, clickable: true },
|
||||
xaxis: { mode: "time",
|
||||
min: dateutil.str_to_obj(this.from_date).getTime(),
|
||||
max: dateutil.str_to_obj(this.to_date).getTime() },
|
||||
series: { downsample: { threshold: 1000 } }
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -1,41 +0,0 @@
|
||||
[
|
||||
{
|
||||
"creation": "2012-09-14 11:25:48",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-11 14:42:21",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Page",
|
||||
"icon": "icon-table",
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"page_name": "general-ledger",
|
||||
"standard": "Yes",
|
||||
"title": "General Ledger"
|
||||
},
|
||||
{
|
||||
"doctype": "Page Role",
|
||||
"name": "__common__",
|
||||
"parent": "general-ledger",
|
||||
"parentfield": "roles",
|
||||
"parenttype": "Page"
|
||||
},
|
||||
{
|
||||
"doctype": "Page",
|
||||
"name": "general-ledger"
|
||||
},
|
||||
{
|
||||
"doctype": "Page Role",
|
||||
"role": "Analytics"
|
||||
},
|
||||
{
|
||||
"doctype": "Page Role",
|
||||
"role": "Accounts Manager"
|
||||
},
|
||||
{
|
||||
"doctype": "Page Role",
|
||||
"role": "Accounts User"
|
||||
}
|
||||
]
|
||||
51
accounts/report/general_ledger/general_ledger.js
Normal file
51
accounts/report/general_ledger/general_ledger.js
Normal file
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
wn.query_reports["General Ledger"] = {
|
||||
"filters": [
|
||||
{
|
||||
"fieldname":"company",
|
||||
"label": wn._("Company"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": wn.defaults.get_user_default("company"),
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname":"account",
|
||||
"label": wn._("Account"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Account"
|
||||
},
|
||||
{
|
||||
"fieldname":"voucher_no",
|
||||
"label": wn._("Voucher No"),
|
||||
"fieldtype": "Data",
|
||||
},
|
||||
{
|
||||
"fieldname":"group_by",
|
||||
"label": wn._("Group by"),
|
||||
"fieldtype": "Select",
|
||||
"options": "\nGroup by Account\nGroup by Voucher"
|
||||
},
|
||||
{
|
||||
"fieldtype": "Break",
|
||||
},
|
||||
{
|
||||
"fieldname":"from_date",
|
||||
"label": wn._("From Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": wn.datetime.add_months(wn.datetime.get_today(), -1),
|
||||
"reqd": 1,
|
||||
"width": "60px"
|
||||
},
|
||||
{
|
||||
"fieldname":"to_date",
|
||||
"label": wn._("To Date"),
|
||||
"fieldtype": "Date",
|
||||
"default": wn.datetime.get_today(),
|
||||
"reqd": 1,
|
||||
"width": "60px"
|
||||
}
|
||||
]
|
||||
}
|
||||
79
accounts/report/general_ledger/general_ledger.py
Normal file
79
accounts/report/general_ledger/general_ledger.py
Normal file
@@ -0,0 +1,79 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import flt
|
||||
from webnotes import _
|
||||
|
||||
def execute(filters=None):
|
||||
validate_filters(filters)
|
||||
columns = get_columns()
|
||||
|
||||
if filters.get("group_by"):
|
||||
data = get_grouped_gle(filters)
|
||||
else:
|
||||
data = get_gl_entries(filters)
|
||||
if data:
|
||||
data.append(get_total_row(data))
|
||||
|
||||
return columns, data
|
||||
|
||||
def validate_filters(filters):
|
||||
if filters.get("account") and filters.get("group_by") == "Group by Account":
|
||||
webnotes.throw(_("Can not filter based on Account, if grouped by Account"))
|
||||
|
||||
if filters.get("voucher_no") and filters.get("group_by") == "Group by Voucher":
|
||||
webnotes.throw(_("Can not filter based on Voucher No, if grouped by Voucher"))
|
||||
|
||||
def get_columns():
|
||||
return ["Posting Date:Date:100", "Account:Link/Account:200", "Debit:Currency:100",
|
||||
"Credit:Currency:100", "Voucher Type::120", "Voucher No::160",
|
||||
"Cost Center:Link/Cost Center:100", "Remarks::200"]
|
||||
|
||||
def get_gl_entries(filters):
|
||||
return webnotes.conn.sql("""select
|
||||
posting_date, account, debit, credit, voucher_type, voucher_no, cost_center, remarks
|
||||
from `tabGL Entry`
|
||||
where company=%(company)s
|
||||
and posting_date between %(from_date)s and %(to_date)s
|
||||
{conditions}
|
||||
order by posting_date, account"""\
|
||||
.format(conditions=get_conditions(filters)), filters, as_list=1)
|
||||
|
||||
def get_conditions(filters):
|
||||
conditions = []
|
||||
if filters.get("account"):
|
||||
conditions.append("account=%(account)s")
|
||||
if filters.get("voucher_no"):
|
||||
conditions.append("voucher_no=%(voucher_no)s")
|
||||
|
||||
return "and {}".format(" and ".join(conditions)) if conditions else ""
|
||||
|
||||
def get_grouped_gle(filters):
|
||||
gle_map = {}
|
||||
gle = get_gl_entries(filters)
|
||||
for d in gle:
|
||||
gle_map.setdefault(d[1 if filters["group_by"]=="Group by Account" else 5], []).append(d)
|
||||
|
||||
data = []
|
||||
for entries in gle_map.values():
|
||||
subtotal_debit = subtotal_credit = 0.0
|
||||
for entry in entries:
|
||||
data.append(entry)
|
||||
subtotal_debit += flt(entry[2])
|
||||
subtotal_credit += flt(entry[3])
|
||||
|
||||
data.append(["", "Total", subtotal_debit, subtotal_credit, "", "", ""])
|
||||
|
||||
if data:
|
||||
data.append(get_total_row(gle))
|
||||
return data
|
||||
|
||||
def get_total_row(gle):
|
||||
total_debit = total_credit = 0.0
|
||||
for d in gle:
|
||||
total_debit += flt(d[2])
|
||||
total_credit += flt(d[3])
|
||||
|
||||
return ["", "Total Debit/Credit", total_debit, total_credit, "", "", ""]
|
||||
21
accounts/report/general_ledger/general_ledger.txt
Normal file
21
accounts/report/general_ledger/general_ledger.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-12-06 13:22:23",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-12-06 13:22:23",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"ref_doctype": "GL Entry",
|
||||
"report_name": "General Ledger",
|
||||
"report_type": "Script Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "General Ledger"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user