Changed the report generated by the csv command
Fields are now: Date,Code,Payee,Account,Commodity,Total,State,Note Instead of outputting amounts potentially as $1,000.00 (which was an error anyway), the output is now: $,1000.00. This makes the commodity available in a separate field, and removes display of thousands markers. Also, european formatting is always off.
This commit is contained in:
parent
a158dc123b
commit
33aa0cc3a6
2 changed files with 15 additions and 4 deletions
14
src/post.cc
14
src/post.cc
|
|
@ -187,11 +187,21 @@ namespace {
|
||||||
}
|
}
|
||||||
|
|
||||||
value_t get_commodity(post_t& post) {
|
value_t get_commodity(post_t& post) {
|
||||||
return string_value(post.amount.commodity().symbol());
|
if (post.has_xdata() &&
|
||||||
|
post.xdata().has_flags(POST_EXT_COMPOUND))
|
||||||
|
return string_value(post.xdata().compound_value.to_amount()
|
||||||
|
.commodity().symbol());
|
||||||
|
else
|
||||||
|
return string_value(post.amount.commodity().symbol());
|
||||||
}
|
}
|
||||||
|
|
||||||
value_t get_commodity_is_primary(post_t& post) {
|
value_t get_commodity_is_primary(post_t& post) {
|
||||||
return post.amount.commodity().has_flags(COMMODITY_PRIMARY);
|
if (post.has_xdata() &&
|
||||||
|
post.xdata().has_flags(POST_EXT_COMPOUND))
|
||||||
|
return post.xdata().compound_value.to_amount()
|
||||||
|
.commodity().has_flags(COMMODITY_PRIMARY);
|
||||||
|
else
|
||||||
|
return post.amount.commodity().has_flags(COMMODITY_PRIMARY);
|
||||||
}
|
}
|
||||||
|
|
||||||
value_t get_has_cost(post_t& post) {
|
value_t get_has_cost(post_t& post) {
|
||||||
|
|
|
||||||
|
|
@ -459,11 +459,12 @@ public:
|
||||||
OPTION__(report_t, csv_format_, CTOR(report_t, csv_format_) {
|
OPTION__(report_t, csv_format_, CTOR(report_t, csv_format_) {
|
||||||
on(none,
|
on(none,
|
||||||
"%(quoted(date)),"
|
"%(quoted(date)),"
|
||||||
|
"%(quoted(code)),"
|
||||||
"%(quoted(payee)),"
|
"%(quoted(payee)),"
|
||||||
"%(quoted(account)),"
|
"%(quoted(account)),"
|
||||||
"%(quoted(scrub(display_amount))),"
|
"%(quoted(commodity)),"
|
||||||
|
"%(quoted(quantity(scrub(display_amount)))),"
|
||||||
"%(quoted(cleared ? \"*\" : (pending ? \"!\" : \"\"))),"
|
"%(quoted(cleared ? \"*\" : (pending ? \"!\" : \"\"))),"
|
||||||
"%(quoted(code)),"
|
|
||||||
"%(quoted(join(note | xact.note)))\n");
|
"%(quoted(join(note | xact.note)))\n");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue