summaryrefslogtreecommitdiff
path: root/src/xact.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-05 17:49:11 -0600
committerJohn Wiegley <johnw@newartisans.com>2012-03-05 17:49:11 -0600
commitff9cf572fe5054f2e5c5d7ab4e68d63011e4a38a (patch)
treea81dcf73e19f2e1886861b12ae881e9abe7b1037 /src/xact.cc
parent46b124a649d652ef88110478db53cc2b7d69069b (diff)
downloadfork-ledger-ff9cf572fe5054f2e5c5d7ab4e68d63011e4a38a.tar.gz
fork-ledger-ff9cf572fe5054f2e5c5d7ab4e68d63011e4a38a.tar.bz2
fork-ledger-ff9cf572fe5054f2e5c5d7ab4e68d63011e4a38a.zip
Added (disabled) code to stop sorting generated balancing postings
Diffstat (limited to 'src/xact.cc')
-rw-r--r--src/xact.cc28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/xact.cc b/src/xact.cc
index 7dbf097d..5cec9ab0 100644
--- a/src/xact.cc
+++ b/src/xact.cc
@@ -331,12 +331,19 @@ bool xact_base_t::finalize()
if (balance.is_balance()) {
const balance_t& bal(balance.as_balance());
- typedef std::map<string, amount_t> sorted_amounts_map;
+#if 1
+ typedef std::map<std::pair<string, annotation_t>,
+ amount_t> sorted_amounts_map;
sorted_amounts_map samp;
foreach (const balance_t::amounts_map::value_type& pair, bal.amounts) {
std::pair<sorted_amounts_map::iterator, bool> result =
- samp.insert(sorted_amounts_map::value_type(pair.first->mapping_key(),
- pair.second));
+ samp.insert(sorted_amounts_map::value_type
+ (sorted_amounts_map::key_type
+ (pair.first->symbol(),
+ pair.first->has_annotation() ?
+ as_annotated_commodity(*pair.first).details :
+ annotation_t()),
+ pair.second));
assert(result.second);
}
@@ -353,6 +360,21 @@ bool xact_base_t::finalize()
add_post(p);
}
}
+#else
+ bool first = true;
+ foreach (const balance_t::amounts_map::value_type& pair, bal.amounts) {
+ if (first) {
+ null_post->amount = pair.second.negated();
+ null_post->add_flags(POST_CALCULATED);
+ first = false;
+ } else {
+ post_t * p = new post_t(null_post->account, pair.second.negated(),
+ ITEM_GENERATED | POST_CALCULATED);
+ p->set_state(null_post->state());
+ add_post(p);
+ }
+ }
+#endif
}
else if (balance.is_amount()) {
null_post->amount = balance.as_amount().negated();