Closing balance fixes in trial balance. Fixes #1730

This commit is contained in:
Nabin Hait 2014-06-02 18:47:13 +05:30
parent be99b1240c
commit 51b7f322cc

View File

@ -145,7 +145,6 @@ erpnext.AccountTreeGrid = frappe.views.TreeGridReport.extend({
this.update_groups();
},
update_balances: function(account, posting_date, v) {
var bal = flt(account.opening_dr) - flt(account.opening_cr) + flt(v.debit) - flt(v.credit);
// opening
if (posting_date < this.opening_date || v.is_opening === "Yes") {
if (account.report_type === "Profit and Loss" &&
@ -153,7 +152,9 @@ erpnext.AccountTreeGrid = frappe.views.TreeGridReport.extend({
// balance of previous fiscal_year should
// not be part of opening of pl account balance
} else {
this.set_debit_or_credit(account, "opening", bal);
var opening_bal = flt(account.opening_dr) - flt(account.opening_cr) +
flt(v.debit) - flt(v.credit);
this.set_debit_or_credit(account, "opening", opening_bal);
}
} else if (this.opening_date <= posting_date && posting_date <= this.closing_date) {
// in between
@ -161,7 +162,9 @@ erpnext.AccountTreeGrid = frappe.views.TreeGridReport.extend({
account.credit += flt(v.credit);
}
// closing
this.set_debit_or_credit(account, "closing", bal);
var closing_bal = flt(account.opening_dr) - flt(account.opening_cr) +
flt(account.debit) - flt(account.credit);
this.set_debit_or_credit(account, "closing", closing_bal);
},
set_debit_or_credit: function(account, field, balance) {
if(balance > 0) {