summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-06-18 01:48:01 +0100
committerJohn Wiegley <johnw@newartisans.com>2009-06-18 01:49:49 +0100
commit1fd4387b678782f2ed90484d36f8980b64d58aa3 (patch)
tree55dd6deb43c90f873e751ff4318e674648221649 /src
parent47d237e18b7902f54ec36ff359ae6e6d0738c67e (diff)
downloadfork-ledger-1fd4387b678782f2ed90484d36f8980b64d58aa3.tar.gz
fork-ledger-1fd4387b678782f2ed90484d36f8980b64d58aa3.tar.bz2
fork-ledger-1fd4387b678782f2ed90484d36f8980b64d58aa3.zip
Restored pricesdb command and --pricesdb-format option
Diffstat (limited to 'src')
-rw-r--r--src/iterators.cc4
-rw-r--r--src/iterators.h2
-rw-r--r--src/post.cc6
-rw-r--r--src/post.h1
-rw-r--r--src/report.h2
5 files changed, 12 insertions, 3 deletions
diff --git a/src/iterators.cc b/src/iterators.cc
index 9b07ace3..63cbb9b2 100644
--- a/src/iterators.cc
+++ b/src/iterators.cc
@@ -101,7 +101,7 @@ void posts_commodities_iterator::reset(journal_t& journal)
foreach (commodity_t::base_t::history_map::value_type hpair,
pair.second.prices) {
xact_t * xact;
- string symbol = hpair.second.commodity().symbol();
+ string symbol = hpair.second.commodity().symbol();
std::map<string, xact_t *>::iterator i =
xacts_by_commodity.find(symbol);
@@ -123,6 +123,8 @@ void posts_commodities_iterator::reset(journal_t& journal)
temp.amount = hpair.second;
temp.set_flags(ITEM_GENERATED | ITEM_TEMP);
+ temp.xdata().datetime = hpair.first;
+
xact->add_post(&temp);
}
}
diff --git a/src/iterators.h b/src/iterators.h
index 67293c5c..ae2ddaf9 100644
--- a/src/iterators.h
+++ b/src/iterators.h
@@ -175,7 +175,7 @@ protected:
std::list<post_t> post_temps;
std::list<account_t> acct_temps;
- xacts_list xact_temps;
+ xacts_list xact_temps;
public:
posts_commodities_iterator() {
diff --git a/src/post.cc b/src/post.cc
index 3a0f3cc4..8eccf03d 100644
--- a/src/post.cc
+++ b/src/post.cc
@@ -244,6 +244,10 @@ namespace {
return long(post.reported_account()->depth);
}
+ value_t get_datetime(post_t& post) {
+ return post.xdata().datetime;
+ }
+
template <value_t (*Func)(post_t&)>
value_t get_wrapper(call_scope_t& scope) {
return (*Func)(find_scope<post_t>(scope));
@@ -282,6 +286,8 @@ expr_t::ptr_op_t post_t::lookup(const string& name)
case 'd':
if (name == "depth")
return WRAP_FUNCTOR(get_wrapper<&get_account_depth>);
+ else if (name == "datetime")
+ return WRAP_FUNCTOR(get_wrapper<&get_datetime>);
break;
case 'h':
diff --git a/src/post.h b/src/post.h
index dc062164..f651d88d 100644
--- a/src/post.h
+++ b/src/post.h
@@ -140,6 +140,7 @@ public:
value_t total;
std::size_t count;
date_t date;
+ datetime_t datetime;
account_t * account;
void * ptr;
diff --git a/src/report.h b/src/report.h
index d48b5a78..89304d31 100644
--- a/src/report.h
+++ b/src/report.h
@@ -626,7 +626,7 @@ public:
OPTION__(report_t, pricesdb_format_, CTOR(report_t, pricesdb_format_) {
on(none,
- "P %[%Y/%m/%d %H:%M:%S] %A %t\n");
+ "P %(datetime) %(account) %(scrub(display_amount))\n");
});
OPTION__(report_t, print_format_, CTOR(report_t, print_format_) {