summaryrefslogtreecommitdiff
path: root/src/report.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-13 03:43:51 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-03-13 03:45:06 -0500
commitc8dd3d28e3ed39ca93f9aac71a127f15c8d65e4b (patch)
tree5c9f9c862da2b193971a8f506c4d519ec0831ac3 /src/report.h
parent2932e05c1841d7154c83ead89f15a664e09ecbf0 (diff)
downloadfork-ledger-c8dd3d28e3ed39ca93f9aac71a127f15c8d65e4b.tar.gz
fork-ledger-c8dd3d28e3ed39ca93f9aac71a127f15c8d65e4b.tar.bz2
fork-ledger-c8dd3d28e3ed39ca93f9aac71a127f15c8d65e4b.zip
Added --time-report option
This is a rather basic option at the moment which only affects the balance report. I use it as follows, for entering contractor hours into a project planning application, where $1 is the contractor's timelog file, and $2 is the date after which new entries appear in the file: ledger -f $1 balance \ --account=payee \ --time-report \ -d "latest > [$2]" \ --datetime-format='%m/%d/%y %I:%M %p'
Diffstat (limited to 'src/report.h')
-rw-r--r--src/report.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/report.h b/src/report.h
index 6322aeb8..c0398d4c 100644
--- a/src/report.h
+++ b/src/report.h
@@ -324,6 +324,7 @@ public:
HANDLER(start_of_week_).report(out);
HANDLER(subtotal).report(out);
HANDLER(tail_).report(out);
+ HANDLER(time_report).report(out);
HANDLER(total_).report(out);
HANDLER(total_data).report(out);
HANDLER(truncate_).report(out);
@@ -947,6 +948,25 @@ public:
OPTION(report_t, subtotal); // -s
OPTION(report_t, tail_);
+ OPTION_(report_t, time_report, DO() {
+ OTHER(balance_format_)
+ .on(none,
+ "%(justify(earliest_checkin ? "
+ " format_datetime(earliest_checkin) : \"\", 19, -1, true)) "
+ "%(justify(latest_checkout ? "
+ " format_datetime(latest_checkout) : \"\", 19, -1, true)) "
+ "%(ansify_if("
+ " justify(scrub(display_total), 8,"
+ " 8 + 4 + 19 * 2, true, color), bold if should_bold))"
+ " %(!options.flat ? depth_spacer : \"\")"
+ "%-(ansify_if("
+ " ansify_if(partial_account(options.flat), blue if color),"
+ " bold if should_bold))\n%/"
+ "%$1 %$2 %$3\n%/"
+ "%(prepend_width ? \" \" * int(prepend_width) : \"\")"
+ "--------------------------------------------------\n");
+ });
+
OPTION__
(report_t, total_, // -T
DECL1(report_t, total_, merged_expr_t, expr, ("total_expr", "total")) {}