1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-06-13 13:39:23 -04:00

Report account balances correctly for both date sorts

This commit is contained in:
2015-08-22 09:46:11 -04:00
parent 693f1e8253
commit 770cd384a7
2 changed files with 21 additions and 11 deletions

View File

@ -355,20 +355,20 @@ const AccountRegister = React.createClass({
}
var transactions = [];
var balance = new Big(data.BeginningBalance);
var balance = new Big(data.EndingBalance);
for (var i = 0; i < data.Transactions.length; i++) {
var t = new Transaction();
t.fromJSON(data.Transactions[i]);
t.Balance = balance.plus(0); // Make a copy of the current balance
// Keep a talley of the running balance of these transactions
for (var j = 0; j < data.Transactions[i].Splits.length; j++) {
var split = data.Transactions[i].Splits[j];
if (this.props.selectedAccount.AccountId == split.AccountId) {
balance = balance.plus(split.Amount);
balance = balance.minus(split.Amount);
}
}
t.Balance = balance.plus(0); // Make a copy
transactions.push(t);
}
var a = new Account();