Commit Graph

596 Commits

Author SHA1 Message Date
Mykola Orliuk
6dbe925eed cli: anonymize transaction code also 2019-11-18 17:42:22 -08:00
Mykola Orliuk
0a273561f7 cli: anonymize declared accounts also
Fixes simonmichael/hledger#901
2019-11-18 17:42:22 -08:00
Michael Kainer
79ca4a767e cli: Add -% to compound balance commands
This commit introduces the commandline argument -%/--percent to show
percentages of the column's total instead of the absolute amounts for
each account in reports. The signs of the values are preserved.

This option is especially useful for the balance and incomestatement
commands.

If there are multiple commodities involved in a report hledger bails
with an error message. This can be avoided by using --cost. Also note
that if one uses -% with the balance command the chances are high that
all numbers are 0. This is due to the fact that by default balance sums
up to zero. If one wants to use -% in a meaningful way with balance one
has to add a query.

In order to keep the implementation as simple as possible --tree has no
influence over how the percentages are calculated, i.e., the percentages
always represent the fraction of the columns total. If one wants to know
the percentages relative to a parent account, one has to use a query to
narrow down the accounts.
2019-11-18 17:10:59 -08:00
Dmitry Astapov
87b82b6839 lib: roi does not fail on empty input data (+test) 2019-11-18 16:13:04 -08:00
Dmitry Astapov
e49da20f8c test: balance-style -> balance-type 2019-11-13 09:06:25 -08:00
Dmitry Astapov
39bc183340 lib: csv reader gets balance-style directive 2019-11-13 09:06:25 -08:00
Simon Michael
c4d7cc198a csv: finalise and check journals generated from CSV (#1000)
Invalid transactions generated from CSV will now be rejected.
I updated some csv tests to avoid this, except for 21, which
probably needs more cleanup.
2019-11-07 18:58:12 -08:00
Dmitry Astapov
fb5bca0b46 test: update csv tests for expenses:unknown being new default 2019-11-05 22:10:41 +00:00
Dmitry Astapov
c66ccc5cee lib: do not try to balance transaction in csv reader 2019-11-05 21:16:42 +00:00
Dmitry Astapov
95ec5715cc lib: better compatibility code in csv reader 2019-11-05 21:16:42 +00:00
Dmitry Astapov
d62f84bec2 lib: csv reader does not generate postings if account="" 2019-11-05 21:16:42 +00:00
Dmitry Astapov
8d24a40150 lib: csv parser fills out amounts on all postings, if possible 2019-11-05 21:16:42 +00:00
Dmitry Astapov
490d2407f4 test: expense:unknown -> expenses:unknown 2019-11-05 21:16:42 +00:00
Dmitry Astapov
3c7d5d466d lib, doc, test: csv parser gains "end" command for "if" block 2019-11-05 21:16:42 +00:00
Dmitry Astapov
32cbe4c7b3 lib: better inference for unknown account names in csv parser 2019-11-05 21:16:42 +00:00
Dmitry Astapov
38db7eb24d lib: implement skip end in csv reader 2019-11-05 21:16:42 +00:00
Dmitry Astapov
f1ab107400 lib, doc: extended "skip" in "if" body to "skip N" 2019-11-05 21:16:42 +00:00
Dmitry Astapov
1acebe1493 test: csv reader test for #1001 2019-11-05 21:16:42 +00:00
Dmitry Astapov
5bd407b3b9 test: show that #1000 is fixed 2019-11-05 21:16:42 +00:00
Dmitry Astapov
fa61fdbe1b test: add a test for #1076 (conditional line skips in csv) 2019-11-05 21:16:42 +00:00
Dmitry Astapov
f74df08e98 lib: fix accidental switch of income:unknown and expence:unknown in csv parser 2019-11-05 21:16:42 +00:00
Dmitry Astapov
825b9ce5b3 lib: fixed amount vs amount1 conflict detection in csv parser 2019-11-05 21:16:42 +00:00
Dmitry Astapov
f40d045251 test: updated csv parser tests to nicer format 2019-11-05 21:16:42 +00:00
Dmitry Astapov
24bba96ea2 lib: more robust multi-line joining in csv parser 2019-11-05 21:16:42 +00:00
Dmitry Astapov
9440664fc4 test: cleaner tests for CSV parser proposal 2019-11-05 21:16:42 +00:00
Dmitry Astapov
09f8d62458 test: example on which recursive interpolation in CSV parser fails 2019-11-05 21:16:42 +00:00
Dmitry Astapov
e4476dd2f1 lib: more robust "unknown" account assignment in csv parser 2019-11-05 21:16:42 +00:00
Dmitry Astapov
294fb4172c test: recursive interpolation in csv rules (#500) 2019-11-05 21:16:42 +00:00
Dmitry Astapov
725bee02f2 test: csv file with multiline description (#841, #416) 2019-11-05 21:16:42 +00:00
Dmitry Astapov
c5bab0ae40 test: added test for #570 2019-11-05 21:16:42 +00:00
Dmitry Astapov
0e1ead74c3 test: update old csv tests for new output format 2019-11-05 21:16:42 +00:00
Dmitry Astapov
a07a084fb7 test: tests for multi-posting CSV import 2019-11-05 21:16:42 +00:00
Simon Michael
312e772468 prices: style price amounts; always show full precision 2019-10-20 07:09:34 -07:00
Simon Michael
f09111b8b9 ;prices: convert tests to new format
[ci skip]
2019-10-20 05:40:49 -07:00
Mykola Orliuk
78146978f4 ;lib: store raw opts unquoted
It looks like we only need quote when we build query and in some
messages.

Fixes simonmichael/hledger#1079
2019-10-19 14:44:08 -07:00
Simon Michael
6dcddadd9f ;journal: in generated-transaction:/posting: tags, add a space before the value 2019-10-07 14:54:36 -10:00
Simon Michael
39635b2fde ;valuation: test documenting new end-date behaviour (#1083)
[ci skip]
2019-09-05 21:03:30 -07:00
Simon Michael
a7f172b085 valuation: -V/-X respects report end date, code/doc cleanups (#1083)
-V (and -X) now respects a report end date set with -e/-p/date: when
choosing the valuation date, similar to hledger 1.14 and Ledger.

This means that -V/-X aren't exactly like either --value=end or
--value=now. The "Effect of --value on reports" doc has been extended
accordingly, and much of it has been reworded and made more accurate.
2019-09-05 13:41:36 -07:00
Simon Michael
7c2511aa29 bs: show end date(s) in title, not transactions date span (#1078)
Compound balance reports showing ending balances (eg balancesheet),
now show the ending date (single column) or range of ending
dates (multi column) in their title. ,, (double comma) is used
rather than - (hyphen) to suggest a sequence of discrete dates
rather than a continuous span.
2019-08-15 18:22:23 +01:00
Simon Michael
84100ca91f ;tests: fix query-tag test 2019-07-27 06:51:15 +01:00
Simon Michael
07c4b3e0ab ;tests: consolidate query tests slightly
[ci skip]
2019-07-26 23:22:46 +01:00
Simon Michael
0b793bca1b tags: add --values flag 2019-07-26 23:18:21 +01:00
Simon Michael
35799142dd
Merge pull request #914 from simonmichael/rule-tags
tags for matching rule-generated txns and postings
2019-07-17 18:38:14 +01:00
Caleb Maclennan
e68e558761 payees: Split command into descriptions, payees, and notes 2019-07-15 08:22:16 +01:00
Caleb Maclennan
a45b42bed5 payees: Add test for what payees command would be expected to do 2019-07-15 08:22:16 +01:00
Simon Michael
5ceb278296 ;journal: tests: note surprising decimal mark parsing
[ci skip]
2019-07-09 11:31:56 +01:00
Simon Michael
6c2398e4d7 close: preserve transaction prices (costs) accurately (#1035)
Transaction prices were being collapsed/misreported after close/open;
this is fixed. Now each separately-priced amount gets its own posting,
and only the last of these (for each commodity) gets a balance
assertion. Also the equity posting's amount is now always shown
explicitly, which in multicommodity situations means that multiple
equity postings are shown. The upshot is that a balance -B report
will be unchanged after closing & opening transactions.
2019-07-09 11:21:22 +01:00
Simon Michael
3059a0b2ca ;close: tests: convert to new format
[ci skip]
2019-07-08 08:57:45 +01:00
Simon Michael
ec56c45c6b ;tests: flatten functional test files a bit
[ci skip]
2019-07-08 08:28:03 +01:00
Simon Michael
0557440f14 ;tests: move 0unittests up, delete unused examples symlink
[ci skip]
2019-07-08 08:02:54 +01:00
Simon Michael
19ba1628bf ;print: more valuation-related tests
[ci skip]
2019-07-08 06:00:28 +01:00
Jakob Schöttl
4d76535b6d Add CLI/shelltest tests for date-options 2019-06-30 10:38:06 +02:00
Simon Michael
016808fd06 ;journal: tests for recursive aliases, application order (#1055)
[ci skip]
2019-06-21 12:16:56 -07:00
Simon Michael
8c7b23e25f ;tests: aliases: convert to shelltest v3 format (#1055)
[ci skip]
2019-06-19 10:44:57 -07:00
Simon Michael
33d03284c3 ;valuation: more tests; document default amount style issue
[ci skip]
2019-06-17 08:19:23 -07:00
Caleb Maclennan
18e19b9ad2 ;tests: normalize tests, examples, and docs using 2spcs before comments 2019-06-13 12:12:21 -07:00
Simon Michael
abf455c10f ;csv: update shelltests format 2019-06-06 14:38:51 -07:00
Simon Michael
aa99743096 make -V do --value=end in multiperiod reports (#329) 2019-05-24 10:30:35 -07:00
Simon Michael
53ac950628 ; number budget tests 2019-05-24 09:49:45 -07:00
Simon Michael
37b30415d5 update valuation tests to match latest #329 scheme 2019-05-23 21:55:19 -07:00
Simon Michael
adbce22152 bal: --budget: don't always convert to cost
And don't show a percentage when budgeted and actual amounts are in
different commodities.
2019-05-23 21:55:18 -07:00
Simon Michael
f999bf78e6 opts: new -B/--cost, -V/--market, --value flags (#329) 2019-05-23 13:11:20 -07:00
Simon Michael
e21afc466a bal/bs/bse: -H or --cumulative now disables -T (#329)
To reduce confusion, multiperiod balance reports using -H/--historical
or --cumulative, which show end balances, no longer show a Totals
column since summing end balances generally doesn't make sense.
Also the underlying MultiBalanceReport now returns zero for those
totals when in cumulative or historical mode.
2019-05-11 20:43:28 -07:00
Simon Michael
76342a3fd0 bal/bs/cf/is: mention valuation type in report title 2019-05-09 15:39:43 -07:00
Simon Michael
fb18019212 bal: document and test --value-at with --budget (#329) 2019-05-09 12:23:51 -07:00
Simon Michael
d77fd5743d bal/bs/cf/is: support --value-at with -H; fix row/col/grand totals
This also includes a big cleanup of multiBalanceReport, which got
accidentally mingled.
2019-05-09 07:58:45 -07:00
Simon Michael
9680e894cc ;tests: fix totals in a --value-at test
[ci skip]
2019-05-09 07:57:03 -07:00
Simon Michael
72214a5747 reg: fix --value-at=transaction with -M (#329) 2019-05-06 08:07:16 -07:00
Simon Michael
ad00da244b reg: support --value-at with -H (#329) 2019-05-05 17:47:38 -07:00
Simon Michael
8d7eacd73f bal: support --value-at=p/t with multiperiod reports (#329) 2019-05-05 09:30:01 -07:00
Simon Michael
ec1b98434c reg: support --value-at=period with periodic reports (#329) 2019-05-04 12:22:00 -07:00
Simon Michael
ebf5ed93f2 valuation: more thorough --value-at; document status (#329, #999)
This feature turns out to be quite involved, as valuation interacts
with the many report variations. Various bugs/specs have been
fixed/clarified relating to register's running total, balance totals
etc. Eg register's total should now be the sum of the posting amount
values, not the values of the original sums. Current level of support
has been documented.

When valuing at transaction date, we once again do early valuation of
all posting amounts, to get more correct results. variants. This means
--value-at=t can be slower than other valuation modes when there are
many transactions and many prices. This could be revisited for
optimisation when things are more settled.
2019-05-03 12:24:02 -07:00
Jakob Schöttl
6d0161d742 Add CLI tests for report interval 2019-04-28 10:44:37 +02:00
Simon Michael
696e3098c8 reg: support --value-at in register reports; cleanups, tests 2019-04-26 12:08:46 -07:00
Simon Michael
00975fb226 bal*: support --value-at in multicolumn balance reports 2019-04-26 12:08:31 -07:00
Simon Michael
65934958f9 rename --value-date -> --value-at; --value-at implies -V 2019-04-26 12:08:31 -07:00
Simon Michael
9adae02973 print: add --value-date general option; implement for print -V 2019-04-26 12:08:31 -07:00
Simon Michael
1d81316681 tests: convert market prices tests to format 3
[ci skip]
2019-04-24 08:43:02 -07:00
Simon Michael
9d3eb8c069 bal, reg, print: -V prefers non-future valuation dates again (#999) 2019-04-24 08:31:21 -07:00
Simon Michael
c23fc8b671 speed up -V/--value by converting reports, not the journal (#999)
Instead of converting all journal amounts to value early on, we now
convert just the report amounts to value, before rendering.

This was basically how it originally worked (for the balance command),
but now it's built in to the four basic reports used by print,
register, balance and their variants - Entries, Postings, Balance,
MultiBalance - each of which now has its own xxValue helper.

This should mostly fix -V's performance when there are many
transactions and prices (the price lookups could still be optimised),
and allow more flexibility for report-specific value calculations.

+------------------------------------------++-----------------+-------------------+--------------------------+
|                                          || hledger.999.pre | hledger.999.1sort | hledger.999.after-report |
+==========================================++=================+===================+==========================+
| -f examples/1000x1000x10.journal bal -V  ||            1.08 |              0.96 |                     0.76 |
| -f examples/2000x1000x10.journal bal -V  ||            1.65 |              1.05 |                     0.73 |
| -f examples/3000x1000x10.journal bal -V  ||            2.43 |              1.58 |                     0.84 |
| -f examples/4000x1000x10.journal bal -V  ||            4.39 |              1.96 |                     0.93 |
| -f examples/5000x1000x10.journal bal -V  ||            7.75 |              2.99 |                     1.07 |
| -f examples/6000x1000x10.journal bal -V  ||           11.21 |              3.72 |                     1.16 |
| -f examples/7000x1000x10.journal bal -V  ||           16.91 |              4.72 |                     1.19 |
| -f examples/8000x1000x10.journal bal -V  ||           27.10 |              9.83 |                     1.40 |
| -f examples/9000x1000x10.journal bal -V  ||           39.73 |             15.00 |                     1.51 |
| -f examples/10000x1000x10.journal bal -V ||           50.72 |             25.61 |                     2.15 |
+------------------------------------------++-----------------+-------------------+--------------------------+

There's one new limitation, not yet resolved: -V once again can pick a
valuation date in the future, if no report end date is specified and
the journal has future-dated transactions. We prefer to avoid that,
but reports currently are pure and don't have access to today's date.
2019-04-23 17:39:01 -07:00
Simon Michael
1cacfcea28 lib: fix journalApplyValue test (#999) 2019-04-23 07:20:10 -07:00
Simon Michael
72c7861267 tests: note parse-errors.test fragility
[ci skip]
2019-04-20 09:25:09 -07:00
Simon Michael
d7161466d3 tests: update i18n test journals, i18n tests 2019-04-20 08:34:08 -07:00
Simon Michael
4fffe74408 doc: add a README for the functional tests, linked from contrib guide 2019-04-19 09:56:33 -07:00
Simon Michael
13dc1096a5 reg: test and fix for --average, broken since 1.12 (#1003) 2019-04-06 11:00:38 -07:00
Dmitry Astapov
3c3200fa66 lib: csv parser support for 'balance2', 'balance' renamed to 'balance1' 2019-03-15 16:18:43 -07:00
Simon Michael
ba850f3871 lib: more transaction balancing/assertions/assignments cleanup 2019-02-20 09:14:30 -08:00
Simon Michael
8789a442a8 lib: inclusive balance assertions (=* and ==*) 2019-02-20 09:14:30 -08:00
Simon Michael
3b47b58aec lib: clarify transaction balancing & balance assertion checking 2019-02-20 09:14:30 -08:00
Simon Michael
6e4ba1106f tests: more tests for #893
[ci skip]
2019-02-01 15:31:38 -08:00
Simon Michael
94771edda2 tests: move, consolidate auto posting tests (#893)
[ci skip]
2019-02-01 15:31:36 -08:00
Simon Michael
33d82fb657 fix: --forecast shouldn't force --auto on (#953, #959) 2019-02-01 11:43:24 -08:00
Simon Michael
6416ad9e54 fix functional test breakage 2019-01-28 20:25:59 -08:00
Dmitry Astapov
f6e5b3d438 lib: make --auto work on --forecast transactions 2019-01-25 12:53:59 -08:00
Dmitry Astapov
f2aaaf3310 lib, cli: merge --show-unbudgeted into --empty 2019-01-25 12:53:09 -08:00
Simon Michael
550e33a558 journal: fix balance assertions/assignments & prices (#824)
Hopefully this is will do it. This restores the past behaviour:

- parsing prices in balance assertions/assignments
- ignoring them in assertions
- using them in assignments
- and printing them

and clarifies tests and docs.
2019-01-25 12:41:10 -08:00
Simon Michael
a5eb5bdff9 journal: fix balance assertions test (#824, #958) 2019-01-25 10:09:40 -08:00
Dmitry Astapov
5711cdf9ba cli: added --transpose to "balance" command 2019-01-24 15:06:35 -08:00
Dmitry Astapov
f3366c7256 lib: fix behavior of nested budgets and --show-unbudgeted 2019-01-24 14:56:22 -08:00
Dmitry Astapov
56553ede69 cli: if abs(return on investment)<0.01% display it as zero 2019-01-24 13:36:11 -08:00