Commit graph

1665 commits

Author SHA1 Message Date
John Wiegley
48d985aacc Restored the --average (-A) report option 2009-02-15 15:50:15 -04:00
John Wiegley
3ef07ae39f Added a helper method for setting expr options
Now one does:

    parent->HANDLER(display_total_).set_expr("total");

Rather than what was required previously:

    parent->HANDLER(display_total_).on("total");
    parent->HANDLER(display_total_).expr = "total";
2009-02-15 15:46:03 -04:00
John Wiegley
5fc1f9dce9 Corrected double problem in period reports
xact_t::add_to_value, in cases where the xact had a "compound" total,
was adding transaction values to the running total twice.
2009-02-15 15:43:13 -04:00
John Wiegley
94aa8e5a91 Changed debug category op.calc to expr.calc 2009-02-15 15:42:12 -04:00
John Wiegley
03219d910f Added xact_t::count member
This allows reports to access the "whicheth" index of the reported
transaction.  It's used mainly by the --average report, which divides
the running total by this count to get the arithmetic mean.
2009-02-15 15:41:24 -04:00
John Wiegley
36b96c47ac Have interval_xacts construct temps on a list 2009-02-14 23:38:14 -04:00
John Wiegley
50f434a5e3 Generate null transactions for empty periods
For example, if one uses -M to generate a monthly report for an entire
year, and there are no transaction in the month of February, ordinarily
Ledger would report nothing for that month, even if -E were used.  Now
"null transactions" are generated for periods without any activity, in
order to make certain reports -- such as running monthly averages --
more accurate.

For example, instead of -MA being just a monthly running average of
months with activity, it is now a true average among all months during
the reported period.
2009-02-14 05:55:09 -04:00
John Wiegley
ee5e0600aa xact metadata searches get passed up to the entry
That is, if a metadata tag cannot be found in a transaction, look in the
parent entry to see if it was set there.  Transactions "inherit"
notational details from their entries.
2009-02-14 05:37:53 -04:00
John Wiegley
67d63366cb Surround command-line queries with implicit parens 2009-02-14 05:33:29 -04:00
John Wiegley
7bbca2bff5 Removed an #if 0'd function from iterators.cc 2009-02-14 04:58:44 -04:00
John Wiegley
6b515c0cb3 Added #if 0'd stub code from 2.x's option.cc 2009-02-14 04:55:44 -04:00
John Wiegley
1933bb2ead Restored the --actual and --real options 2009-02-14 04:46:53 -04:00
John Wiegley
5290b6e8aa If an option was given no value, throw an error
The previous behavior was to trigger a confusing assertion.
2009-02-14 04:35:22 -04:00
John Wiegley
7fb55eedef Re-enabled periodic reporting options (-M, etc) 2009-02-14 04:31:15 -04:00
John Wiegley
388044dec9 Fixed the way interval_t objects are initialized 2009-02-14 04:27:15 -04:00
John Wiegley
e50abb5645 Removed interval_t::advanced, which was unused 2009-02-14 04:17:46 -04:00
John Wiegley
f15ae10a52 Enabled --cleared, --uncleared and --pending
Note that the --uncleared flag includes --pending, since it specifically
means "not yet cleared".
2009-02-13 20:03:58 -04:00
John Wiegley
a87ed245d7 Changed the semantics of the "prices" report
The prices report now uses the following scheme:

    PAYEE   -> name of commodity of price
    ACCOUNT -> name of commodity of item
    AMOUNT  -> price
    DATE    -> date of pricing

However, the report does not show the payee.  The only reason the payee
is set is to enable clever querying.  For example:

    ledger prices gold        # show all known prices for GOLD
    ledger prices @gold       # show all known prices *in* GOLD
2009-02-13 19:30:53 -04:00
John Wiegley
326cbea4c7 The formatting code no longer justifies values
This is done in the value code, which knows -- based on the value's type
-- how best to apply the justification.
2009-02-13 19:27:37 -04:00
John Wiegley
a9061811ce Greatly improved output from the "format" command
It now shows the formatted result against a sample entry, similar to
what "parse" now does.
2009-02-13 19:25:15 -04:00
John Wiegley
b345a45c9b Don't print an xact's amount if it was calculated
That is, if the user didn't enter an amount for that transaction in
their ledger journal, don't print one out either.
2009-02-13 18:33:28 -04:00
John Wiegley
7a0e61f458 Removed auto-reconciling behavior from ledger.el 2009-02-13 18:23:52 -04:00
John Wiegley
2522f15437 Re-activated the budgeting flags
However, the budget reports themselves still need to be tested.
2009-02-13 06:13:19 -04:00
John Wiegley
206cb4cce3 Added tools/sample.sh, which uses tools/sample.py 2009-02-13 06:09:46 -04:00
John Wiegley
51e0bc8a82 Set coding-system-for-read, as well as write 2009-02-13 05:38:45 -04:00
John Wiegley
10ba30ddfd Added tools/excludes and tools/pre-commit
These files are used to creat ea Git pre-commit hook which verifies each
proposed change by running "make check".  Otherwise, I only know if my
working tree is sane, and not if each commit is sane before it goes into
the repository.
2009-02-13 05:33:55 -04:00
John Wiegley
70344b82e7 Added a "reload" command, for use at the REPL
Created a new function, session_t::reread_journal_files, which throws
away all previous state data and reads in the same files again.  This is
needed to allow Emacs to communicate with Ledger via the REPL, so that
it tell Ledger when it has made changes to the user's data file.
2009-02-13 05:24:28 -04:00
John Wiegley
037dd0f716 Set coding-system-for-write when talking to ledger
Otherwise, calling out to Ledger uses whatever the user's default
happens to be, such as iso-latin-1.  This caused problems for one user
who had euro symbols encoding in utf-8 in his data file.
2009-02-13 05:02:37 -04:00
John Wiegley
60019dc4b4 Changed print report to use format_date
Otherwise, Ledger was unable to parse what it had printed.
2009-02-13 02:09:19 -04:00
John Wiegley
f6b93a3f5a Added a new valexpr function: format_date
This can be used to format dates with a specific pattern, such as:

    format_date(entry.date, "%Y/%m/%d")

This is used by the print command to ensure that Ledger is able to parse
back what it prints.
2009-02-13 02:04:09 -04:00
John Wiegley
c0fd8d5e15 If a LEDGER_ envvar has no value, ignore it 2009-02-13 01:53:33 -04:00
John Wiegley
f594bf787a Removed CppUnit submodule reference
This library is a dependency for running "make check", but it's not
built as part of a Ledger build, and so doesn't belong as a submodule.
2009-02-13 01:52:48 -04:00
John Wiegley
d3daa9b5dd Reorganized the way acprep handles switches
Now it takes --warn and --debug flags, and I use tools/myacprep to
collect together all the flags I normally use in development.
2009-02-13 01:50:15 -04:00
John Wiegley
49a1373deb Renamed a function to sort_value_is_less_than
The purpose was to provided a clearer relationship between the function
name and its expected arguments.
2009-02-12 22:47:27 -04:00
John Wiegley
62eee3d29a Removed a bad variable setting in acprep 2009-02-12 22:46:56 -04:00
John Wiegley
09134d6e81 Added -I/sw/include to Fink to acprep users 2009-02-12 22:14:10 -04:00
John Wiegley
092542a3bf Sorting expr now uses "-" to indicate descending
For example: -S payee,-date sorts 1) ascending by payee, then 2)
descending by date.
2009-02-12 20:45:33 -04:00
John Wiegley
e0e181d2af Made (un)reduce rvalue methods more consistent
They names were changed from reduce/unreduce to reduced/unreduced, since
they return the modified value.  This is more consistent with the naming
of rounded/rounded.
2009-02-12 20:44:46 -04:00
John Wiegley
e6bea6c3eb The --sort flag now accepts multiple terms (-S payee,date).
However, there is no way yet to reverse the meaning of a given term.
2009-02-12 16:22:12 -04:00
John Wiegley
8ee8af3bfb Restored the "prices" command. 2009-02-12 04:57:19 -04:00
John Wiegley
c328b1b3b2 Turned on the "emacs" command and budgeting, though neither are tested yet. 2009-02-12 03:30:57 -04:00
John Wiegley
c8cd2c468e Re-enabled some code, and removed a bunch of deadwood. 2009-02-12 03:30:41 -04:00
John Wiegley
bb243e2c5e Fixed a typo which was causing all boolean values to show as "false". 2009-02-12 03:06:30 -04:00
John Wiegley
dc68903bb2 Added validation code for mask_t objects. 2009-02-12 03:06:15 -04:00
John Wiegley
eaac95147c Added a missing file! 2009-02-12 02:38:25 -04:00
John Wiegley
433bb11fa9 Moved value_t::set_type into value.cc, since it had grown. 2009-02-12 02:36:14 -04:00
John Wiegley
9344598eb0 Inlined value_t::_clear(), since it only had one caller. 2009-02-12 02:35:22 -04:00
John Wiegley
f8c48d7a6f Ignore lines in Ledger files which contain only whitespace. 2009-02-12 02:35:05 -04:00
John Wiegley
b53f844129 Removed an excessive error check. 2009-02-12 02:34:54 -04:00
John Wiegley
6f2e3b8864 Properly handle UTF-8 characters in commodity strings. 2009-02-12 02:34:39 -04:00