summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-08-14 04:29:41 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-08-14 04:29:41 -0400
commit24e8977b57218cfac704068a3221558d1ce009a7 (patch)
tree8954d8f11d356ce3da898a464c27a662004e7a9a
parenta5d9e21065bf553d8ea80914f2cb4d477384939a (diff)
downloadfork-ledger-24e8977b57218cfac704068a3221558d1ce009a7.tar.gz
fork-ledger-24e8977b57218cfac704068a3221558d1ce009a7.tar.bz2
fork-ledger-24e8977b57218cfac704068a3221558d1ce009a7.zip
fixed -G report
-rw-r--r--ledger.h1
-rw-r--r--main.cc2
-rw-r--r--walk.cc11
3 files changed, 10 insertions, 4 deletions
diff --git a/ledger.h b/ledger.h
index 8a781c53..96f54d69 100644
--- a/ledger.h
+++ b/ledger.h
@@ -34,6 +34,7 @@ namespace ledger {
#define TRANSACTION_HANDLED 0x10
#define TRANSACTION_DISPLAYED 0x20
+#define TRANSACTION_NO_TOTAL 0x40
class entry_t;
class account_t;
diff --git a/main.cc b/main.cc
index b0d6e96b..ecac29e4 100644
--- a/main.cc
+++ b/main.cc
@@ -407,7 +407,7 @@ OPT_BEGIN(gain, "G", false) {
show_revalued =
show_revalued_only = true;
- value_expr = "c";
+ value_expr = "a";
total_expr = "G";
} OPT_END(gain);
diff --git a/walk.cc b/walk.cc
index ce7ddd8a..1f58f0c6 100644
--- a/walk.cc
+++ b/walk.cc
@@ -32,7 +32,8 @@ void calc_transactions::operator()(transaction_t * xact)
xact->cost.negate();
}
- xact->total += *xact;
+ if (! (xact->dflags & TRANSACTION_NO_TOTAL))
+ xact->total += *xact;
(*handler)(xact);
@@ -102,8 +103,12 @@ void changed_value_transactions::operator()(transaction_t * xact)
xact_temps.push_back(temp_xact);
temp_xact->amount = (*i).second;
- temp_xact->total = (*i).second;
- temp_xact->total.negate();
+ if (changed_values_only) {
+ temp_xact->dflags |= TRANSACTION_NO_TOTAL;
+ } else {
+ temp_xact->total = (*i).second;
+ temp_xact->total.negate();
+ }
(*handler)(temp_xact);
}