fixes for debit_or_credit in account tree grid report
This commit is contained in:
parent
53822ae9d0
commit
2b57ecbd6c
@ -148,16 +148,16 @@ erpnext.FinancialAnalytics = erpnext.AccountTreeGrid.extend({
|
||||
if(!ac.parent_account && me.apply_filter(ac, "company")) {
|
||||
if(me.pl_or_bs == "Balance Sheet") {
|
||||
var valid_account = ac.is_pl_account!="Yes";
|
||||
var do_addition_for = "Debit";
|
||||
var do_addition_for = "Asset";
|
||||
} else {
|
||||
var valid_account = ac.is_pl_account=="Yes";
|
||||
var do_addition_for = "Credit";
|
||||
var do_addition_for = "Income";
|
||||
}
|
||||
if(valid_account) {
|
||||
$.each(me.columns, function(i, col) {
|
||||
if(col.formatter==me.currency_formatter) {
|
||||
if(!net_profit[col.field]) net_profit[col.field] = 0;
|
||||
if(ac.debit_or_credit==do_addition_for) {
|
||||
if(ac.root_type==do_addition_for) {
|
||||
net_profit[col.field] += ac[col.field];
|
||||
} else {
|
||||
net_profit[col.field] -= ac[col.field];
|
||||
@ -172,8 +172,8 @@ erpnext.FinancialAnalytics = erpnext.AccountTreeGrid.extend({
|
||||
}
|
||||
},
|
||||
add_balance: function(field, account, gl) {
|
||||
account[field] = flt(account[field]) +
|
||||
((account.debit_or_credit == "Debit" ? 1 : -1) * (flt(gl.debit) - flt(gl.credit)))
|
||||
account[field] = flt(account[field]) + ((in_list(["Asset", "Expense"],
|
||||
account.root_type) ? 1 : -1) * (flt(gl.debit) - flt(gl.credit)));
|
||||
},
|
||||
init_account: function(d) {
|
||||
// set 0 values for all columns
|
||||
|
@ -152,7 +152,7 @@ erpnext.AccountTreeGrid = frappe.views.TreeGridReport.extend({
|
||||
// balance of previous fiscal_year should
|
||||
// not be part of opening of pl account balance
|
||||
} else {
|
||||
if(account.debit_or_credit=='Debit') {
|
||||
if(in_list(["Asset", "Expense"], account.root_type)) {
|
||||
account.opening_debit += (v.debit - v.credit);
|
||||
} else {
|
||||
account.opening_credit += (v.credit - v.debit);
|
||||
@ -164,7 +164,7 @@ erpnext.AccountTreeGrid = frappe.views.TreeGridReport.extend({
|
||||
account.credit += v.credit;
|
||||
}
|
||||
// closing
|
||||
if(account.debit_or_credit=='Debit') {
|
||||
if(in_list(["Asset", "Expense"], account.root_type)) {
|
||||
account.closing_debit = account.opening_debit + account.debit - account.credit;
|
||||
} else {
|
||||
account.closing_credit = account.opening_credit - account.debit + account.credit;
|
||||
|
Loading…
x
Reference in New Issue
Block a user