From c8dd3d28e3ed39ca93f9aac71a127f15c8d65e4b Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 13 Mar 2012 03:43:51 -0500 Subject: 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' --- src/report.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/report.h') 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")) {} -- cgit v1.2.3