@@ -371,21 +371,30 @@ public boolean hasUnexportedTransactions(){
371371 public Money getBalance (){
372372 Money balance = new Money (new BigDecimal (0 ), this .mCurrency );
373373 for (Transaction transaction : mTransactionsList ) {
374- boolean isDebitAccount = getAccountType ().hasDebitNormalBalance ();
375- boolean isDebitTransaction = transaction .getType () == TransactionType .DEBIT ;
376- if (isDebitAccount ) {
377- if (isDebitTransaction ) {
378- balance = balance .add (transaction .getAmount ());
379- } else {
380- balance = balance .subtract (transaction .getAmount ());
381- }
382- } else {
383- if (isDebitTransaction ) {
384- balance = balance .subtract (transaction .getAmount ());
385- } else {
386- balance = balance .add (transaction .getAmount ());
387- }
388- }
374+ balance = balance .add (transaction .getAmount ());
375+
376+ /*
377+ //TODO: Re-enable proper computation of balance for double-entries in the future
378+ if (GnuCashApplication.isDoubleEntryEnabled(false)) {
379+ boolean isDebitAccount = getAccountType().hasDebitNormalBalance();
380+ boolean isDebitTransaction = transaction.getType() == TransactionType.DEBIT;
381+ if (isDebitAccount) {
382+ if (isDebitTransaction) {
383+ balance = balance.add(transaction.getAmount());
384+ } else {
385+ balance = balance.subtract(transaction.getAmount());
386+ }
387+ } else {
388+ if (isDebitTransaction) {
389+ balance = balance.subtract(transaction.getAmount());
390+ } else {
391+ balance = balance.add(transaction.getAmount());
392+ }
393+ }
394+ } else { //not using double entry
395+ balance = balance.add(transaction.getAmount());
396+ }
397+ */
389398 }
390399 return balance ;
391400 }
0 commit comments