Commit graph

64 commits

Author SHA1 Message Date
John Wiegley
963161a817 bal was sometimes reporting empty accounts 2010-06-21 18:32:03 -04:00
John Wiegley
31e8ed7587 Individual postings may each have their own payee
If a posting has the metadata field "Payee" set to a string, that will
be used as the payee name for that posting.  This affects the register
report, the payees report, and the --by-payee option.

This is useful because sometimes I send, say, 4 checks at a time to my
bank.  So on my bank statement, this is all just one amount:

   2010-06-17 Sample
     Assets:Bank        $400.00
     Income:Check1     $-100.00
     Income:Check2     $-100.00
     Income:Check3     $-100.00
     Income:Check4     $-100.00

Though it's important that the Assets:Bank posting be a single posting
of $400 value, I'd like for income reports to show whom each check came
from.  Now I can say:

   2010-06-17 Sample
     Assets:Bank        $400.00
     Income:Check1     $-100.00  ; Payee: Person One
     Income:Check2     $-100.00  ; Payee: Person Two
     Income:Check3     $-100.00  ; Payee: Person Three
     Income:Check4     $-100.00  ; Payee: Person Four

When I report this, it appears as:

10-Jun-17 Sample             Assets:Bank             $400.00     $400.00
          Person One         Income:Check1          $-100.00     $300.00
          Person Two         Income:Check2          $-100.00     $200.00
          Person Three       Income:Check3          $-100.00     $100.00
          Person Four        Income:Check4          $-100.00           0

This shows that they are all in the same transaction (which is why the
date is not repeated), but they have different payees.
2010-06-17 23:42:23 -04:00
John Wiegley
dea2aed0b5 Untabified all source files 2010-06-11 17:02:25 -04:00
John Wiegley
8bd362b5d1 Minor optimization of how non --empty is handled 2010-06-07 08:32:13 -04:00
John Wiegley
647d4aac2f New: --group-by=EXPR and --group-title-format=FMT
The --group-by option allows for most reports to be split up into
sections based on the varying value of EXPR.  For example, to see
register subtotals by payee, use:

  ledger reg --group-by=payee -s

This works for separated balances too:

  ledger bal --group-by=payee

Another interesting possibility is seeing a register of all the accounts
affected by a related account:

  ledger reg -r --group-by=payee

The option --group-title-format can be used to add a separator bar to
the group titles.  The option --no-titles can be used to drop titles
altogether.
2010-05-30 02:47:40 -06:00
John Wiegley
a7c28aa200 Added new option --prepend-width
This is useful for making sure that the column containing the results of
--prepend-format is a consistent width throughout the report (including
those lines where it is not applied).

Fixes 64F9D913-75E1-4830-A3D9-29B72442E68B
2010-05-22 21:35:03 -04:00
John Wiegley
02e7825516 Option --count sums payees, account, commodities 2010-05-22 21:35:02 -04:00
John Wiegley
de3803d027 Added new commands: acounts, payees, commodities
These three reports simply dump an unordered list (with the exception of
payees) shows all accounts, payees, and commodities represented in a
given report.  This can be used to easily generate per-entity report,
for example:

  ledger payees | \
  while read payee; do \
    echo ; echo $payee ; \
    ledger reg payee "$payee" ; \
  done
2010-05-22 21:35:02 -04:00
John Wiegley
75b7294a6d Rewrite the "print" command as a custom function
There ended up being too many corner cases for the generalized formatter
to handle.
2010-03-08 01:11:48 -05:00
John Wiegley
ab416f759f Updated copyrights to 2003-2010 2010-03-05 22:14:10 -05:00
John Wiegley
61edd3d8f4 Fixed account display bug in the balance report 2010-01-21 04:55:11 -05:00
John Wiegley
a4b1e7c5ab Added a --prepend-format option
This lets you, for example, debug registers that cull data from many
different sources, without having to change the basic formatting
string.  You can locate each posting's location with this:

  ledger reg --prepend-format='%-25(filename + ":" + beg_line)'
2009-11-11 02:01:24 -05:00
John Wiegley
fb8be53edb Redesigned the format_t class 2009-11-09 02:06:08 -05:00
John Wiegley
c3535d06c8 Redesigned the expr_t, predicate_t, query_t classes 2009-11-09 02:06:06 -05:00
John Wiegley
63aa8992a8 Moved ownership of master account into journal_t
The journal_t now completely represents the data part of a session.
2009-10-30 19:03:28 -04:00
John Wiegley
aae134f692 Fixed a display issue with the balance report 2009-10-27 19:01:55 -04:00
John Wiegley
0fdb900c99 Redid the way temporaries are handled in filtering 2009-10-27 08:30:39 -04:00
John Wiegley
151a8d87ee Fixed sorting in bal reports when --flat is used
Note that sorting on the "total" is not the same thing as sorting on the
"display_total" when multiple commodities are in use and the -X flag is
selected!  One should always sort on display_total, since that's the
value which is shown in the report.  'T' is a synonym for display_total.
2009-10-26 18:52:26 -04:00
John Wiegley
d85a415bc5 In the balance report, don't output any account twice 2009-10-26 17:23:46 -04:00
John Wiegley
bf30f989f6 Removed some dead code 2009-06-27 01:32:46 +01:00
John Wiegley
521b935aa8 Restored --percent option, added baseline test 2009-06-21 18:07:27 +01:00
John Wiegley
e97b59b006 Refinement to display of account balances
Fixes 5A03CFC3-1A76-4F93-A1FE-555F98438C5A
2009-06-15 17:52:52 +01:00
John Wiegley
16c77af9c9 If 2+ child accounts are shown, show the parent
Also, also show a final balance if there are multiple accounts
displayed, even if that final balance is zero.
2009-03-15 21:31:06 -04:00
John Wiegley
d0963ece02 If a balance report is multi-lined, print a total 2009-03-15 04:14:03 -04:00
John Wiegley
97784f72a2 Moved a variable initialization 2009-03-11 19:08:52 -04:00
John Wiegley
110f0b8023 Enabled use of pre-compiled headers by default 2009-03-10 17:02:03 -04:00
John Wiegley
77faaa926f Rewrote the balance report again, to fix --depth 2009-03-08 04:15:48 -04:00
John Wiegley
f340d50362 Revised the ways statistics are computed
It is no longer done in calc_posts, but recursively on each account.
This allows value expressions to ask statistical questions, like
"earliest cleared posting?" (TBD) from any specific account, computed
lazily.
2009-03-06 04:07:25 -04:00
John Wiegley
2728e4d55e Changed the way that account balances are computed 2009-03-06 00:27:29 -04:00
John Wiegley
c11d325712 Reduced the #include dependency tree to a minimum 2009-03-04 23:53:43 -04:00
John Wiegley
1540ccec01 Gather account details in a details_t structure 2009-03-03 20:28:09 -04:00
John Wiegley
eb45a0a4f4 Normalized how account totals are calculated 2009-03-03 17:08:11 -04:00
John Wiegley
56693fab9b Separator in "balance" now part of format string 2009-02-27 16:23:36 -04:00
John Wiegley
238bd7f8a5 Marked all strings needing internationalization
These strings are now collected automagically in the file po/ledger.pot.
If you'd like to produce a translation, just run this command after
building Ledger:

    msginit -l LOCALE -o LANG.po -i po/ledger.pot

Where LOCALE is a string like de or en_GB, and LANG is a short
descriptive word for your language.

Then send me this .po file so I can commit it to the Ledger sources
(alternatively, you could maintain the file in a fork on GitHub), and
setup the build script to format and install your new message catalog
during a "make install".
2009-02-25 03:51:42 -04:00
John Wiegley
944c63e6f2 The Great Renaming, Part II
The last commit did not contain the majority of changes because of a
slight mishap.  This contains the real changeset.
2009-02-23 19:07:30 -04:00
John Wiegley
9f53efbf5f Many fixes to both --market and --exchange 2009-02-23 01:51:23 -04:00
John Wiegley
a577e8c48e Added a new --raw option, for use with print 2009-02-21 19:45:13 -04:00
John Wiegley
dc63429785 Removed an unused class: format_entries 2009-02-21 19:22:55 -04:00
John Wiegley
31feaad105 Added --no-total option
This simply omits the final total in the balance report, nothing more.
2009-02-20 15:41:49 -04:00
John Wiegley
c1b25fcf86 Rewrote the equity command, which is working again
The old implementation used an account formatter, and was very
specialized.  The new is done as a transaction filter, and works along
with everything else, eliminating bugs special to the equity report.
2009-02-20 02:53:54 -04:00
John Wiegley
9805abbf2b Allow for sorting of the balance report
Sorting is repeated at each level of the hierarchy, unless --flat was
specified in which case it applies to the entire applicable accounts
list.
2009-02-19 16:53:25 -04:00
John Wiegley
4ec2dfeef1 Added --flat option, to flatten the balance report 2009-02-17 21:19:31 -04:00
John Wiegley
93d195f1d9 Only display a final balance total if necessary
In the case where only one top-level account is being reported, there is
no reason to duplicate the total balance shown.
2009-02-17 19:48:42 -04:00
John Wiegley
ce8442a30d Rewrote how the balance command displays accounts
The previous method bent over backwards to try and avoid multiple passes
through the account tree, but the result was a horribly complicated mess
that never ceased to dredge up obscure bugs.  The new scheme is a very,
very simple two-pass algorithm, with multiple subpasses during the
second pass for refining the output based on the report options.
2009-02-17 04:49:10 -04:00
John Wiegley
e6934fbd3c Removed an unused extended account xdata flag 2009-02-16 21:23:12 -04:00
John Wiegley
e3b44038b3 Moved format_accounts::should_display out of line 2009-02-16 21:00:30 -04:00
John Wiegley
32e2d58d43 Simplified the stats command 2009-02-16 05:03:04 -04:00
John Wiegley
479ac0ce36 Fleshed out the "stats" command 2009-02-16 04:50:11 -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
af3be5f964 Wrote the beginnings of a new "stats" command. 2009-02-10 15:57:34 -04:00