added Net Profit in financial analytis
This commit is contained in:
parent
7507303d34
commit
42d37bf6c2
@ -141,6 +141,43 @@ erpnext.FinancialAnalytics = erpnext.AccountTreeGrid.extend({
|
|||||||
}
|
}
|
||||||
this.update_groups();
|
this.update_groups();
|
||||||
this.accounts_initialized = true;
|
this.accounts_initialized = true;
|
||||||
|
|
||||||
|
// show Net Profit / Loss
|
||||||
|
var net_profit = {
|
||||||
|
company: me.company,
|
||||||
|
id: "Net Profit / Loss",
|
||||||
|
name: "Net Profit / Loss",
|
||||||
|
indent: 0,
|
||||||
|
opening: 0,
|
||||||
|
checked: false,
|
||||||
|
is_pl_account: me.pl_or_bs=="Balance Sheet" ? "No" : "Yes",
|
||||||
|
};
|
||||||
|
|
||||||
|
$.each(me.data, function(i, ac) {
|
||||||
|
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";
|
||||||
|
} else {
|
||||||
|
var valid_account = ac.is_pl_account=="Yes";
|
||||||
|
var do_addition_for = "Credit";
|
||||||
|
}
|
||||||
|
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) {
|
||||||
|
net_profit[col.field] += ac[col.field];
|
||||||
|
} else {
|
||||||
|
net_profit[col.field] -= ac[col.field];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.data.push(net_profit);
|
||||||
},
|
},
|
||||||
add_balance: function(field, account, gl) {
|
add_balance: function(field, account, gl) {
|
||||||
account[field] = flt(account[field]) +
|
account[field] = flt(account[field]) +
|
||||||
|
@ -84,12 +84,7 @@ erpnext.AccountTreeGrid = wn.views.TreeGridReport.extend({
|
|||||||
},
|
},
|
||||||
prepare_data: function() {
|
prepare_data: function() {
|
||||||
var me = this;
|
var me = this;
|
||||||
if(this.data) {
|
if(!this.primary_data) {
|
||||||
// refresh -- only initialize
|
|
||||||
$.each(this.data, function(i, d) {
|
|
||||||
me.init_account(d);
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
// make accounts list
|
// make accounts list
|
||||||
me.data = [];
|
me.data = [];
|
||||||
me.parent_map = {};
|
me.parent_map = {};
|
||||||
@ -103,10 +98,16 @@ erpnext.AccountTreeGrid = wn.views.TreeGridReport.extend({
|
|||||||
if(d.parent_account) {
|
if(d.parent_account) {
|
||||||
me.parent_map[d.name] = d.parent_account;
|
me.parent_map[d.name] = d.parent_account;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
me.primary_data = [].concat(me.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
me.data = [].concat(me.primary_data);
|
||||||
|
$.each(me.data, function(i, d) {
|
||||||
me.init_account(d);
|
me.init_account(d);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
this.set_indent();
|
this.set_indent();
|
||||||
this.prepare_balances();
|
this.prepare_balances();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user