Commit Graph

471 Commits

Author SHA1 Message Date
Stephen Morgan
371b349b2e lib,cli: Replace parsedate and mkdatespan with direct applications of fromGregorian, transaction now takes Day instead of a date string. 2020-08-29 15:08:28 -07:00
Stephen Morgan
32e184f9a8 lib: Elide boring parents in tree mode even when using --empty. 2020-08-11 17:24:50 -07:00
Simon Michael
3f55c23603 ;review, tag all error calls with an easier to find PARTIAL: comment (#1312) 2020-08-05 16:08:33 -07:00
Simon Michael
242c05fc9a lib, journal: parseQuery, modifyTransactions are now total (#1312)
modifyTransactions now also requires a reference date, for parsing queries.
Relative dates are now permitted in auto posting rules.
2020-08-05 13:44:04 -07:00
Simon Michael
d738ca8c60 ;lib: cleanups 2020-07-19 06:13:38 -07:00
Simon Michael
e057857c04 ;lib: CBCSubreportSpec note 2020-07-17 10:02:14 -07:00
Stephen Morgan
30f02b0882 lib: account name clipping takes Maybe Int as depth. 2020-07-17 07:41:27 -07:00
Stephen Morgan
51ea6d9f25 lib: Make queryDepth return Maybe Int. 2020-07-16 10:05:53 -07:00
Simon Michael
3452270241 cli: --color/--colour option; smart emacs, windows autodetection (#1296) 2020-07-14 12:08:36 -07:00
Simon Michael
9198449ee3 areg: an account transaction register like the ones in ui/web (#1294)
;areg: debug output

;areg: show a title indicating which account was picked

This might be a bit of a pain for scripting, but otherwise it can be
quite confusing if your argument matches an account you didn't expect.

;areg: improve CSV headings

;areg: show at most two commodities per amount
2020-07-14 10:24:57 -07:00
Simon Michael
3f86bd545f lib, ui, web: stricter accountTransactionsReport filtering
accountTransactionsReport now filters transactions more thoroughly, so
eg transactions dated outside the report period will not be shown.
Previously the transaction would be shown if it had any posting dated
inside the report period. Possibly some other filter criteria now get
applied that didn't before. I think on balance this will give slightly
preferable results.
2020-07-14 10:22:14 -07:00
Simon Michael
febd8bb457 lib: postingsReport: follow debug levels policy 2020-07-13 11:53:05 -07:00
Stephen Morgan
463eee7bf4 lib: Replace {pr,prr}Negate with fmap negate. 2020-07-10 09:08:03 -07:00
Simon Michael
f518da747c balcmds: avoid short month names in multi-year monthly reports 2020-07-09 12:56:46 -07:00
Simon Michael
f4991d05b4 lib: list exports of Hledger.Reports.BudgetReport 2020-07-09 12:55:04 -07:00
Simon Michael
23bef9a01b ;refactor: extracted reportPeriodName for making report headings 2020-07-09 12:54:20 -07:00
Simon Michael
a89a4e1b42 bal --budget: show end-date column headings when appropriate
bal --budget was always showing the period as column heading,
as if for a change report. With --cumulative or --historical
it should show the end date, like other balance reports. Cf
https://hledger.org/hledger.html#multicolumn-balance-report.
2020-07-09 11:49:19 -07:00
Stephen Morgan
f5e1fb2625 lib: Refactor BudgetReport to re-use MultiBalanceReport code. 2020-07-07 18:46:34 -07:00
Stephen Morgan
bfda10ff20 lib: Refactor MultiBalanceReport row sorting, make sure totals are calculated after pruning. 2020-07-07 18:46:34 -07:00
Stephen Morgan
bde4d7e2e4 lib: Use last column of historical balance as total. Use totals for balanceReport. 2020-07-07 17:56:38 -07:00
Stephen Morgan
1425301a8c lib, cli: Use --flat as the default mode for all reports. 2020-07-07 15:49:08 -07:00
Stephen Morgan
df84a417d7 doc: Remove references to old limitations of boring parent ellision. 2020-07-07 15:49:08 -07:00
Simon Michael
25c15d4bab bal --budget: elide multicommodity amounts 2020-07-05 06:59:16 -07:00
Simon Michael
44c3eb1904 add a color argument to most amount show helpers, drop cshow variants
This is an API change, but it seems better than having additional
colour-supporting variants and trying to avoid duplicated code.
I stopped short of changing showAmount, so cshowAmount still exists.
2020-07-05 06:59:16 -07:00
Stephen Morgan
c811ea4c7b lib, cli, ui, web: intopt and friends now make sure their arguments fit
inside bounds.
2020-07-03 12:35:51 -07:00
Stephen Morgan
c96947284e lib: Minor refactor. 2020-07-03 12:35:51 -07:00
Stephen Morgan
4fc72328d2 lib, cli: Introduce convienience function compoundBalanceReport. 2020-06-28 07:29:49 -07:00
Stephen Morgan
604868cea5 lib, cli: Move CompoundBalanceReport into ReportTypes, compoundReportWith into MultiBalanceReport, share postings amongst subreports. 2020-06-28 07:29:49 -07:00
Stephen Morgan
d09a90b38b lib: Refactor multiBalanceReportWith into getPostingsbyColumn and generateMultiBalanceReport. 2020-06-28 07:29:49 -07:00
Stephen Morgan
e089358758 lib: Using --drop in tree mode with boring parent ellision no longer considers all parents boring. Add tests to check this fact. 2020-06-25 18:05:50 -07:00
Stephen Morgan
015492553e lib: Move unifyMixedAmount to Hledger.Data.Amount, make it return Maybe Amount, export it. 2020-06-24 10:24:11 -07:00
Stephen Morgan
ded4f42218 lib: multiBalanceReport: Accounts with no subaccounts are never interesting parents, even if no_elide_ is set. 2020-06-23 13:19:52 +10:00
Stephen Morgan
826faa18c2 lib: Tweaks to work with stack-8.2. 2020-06-22 23:08:22 +10:00
Stephen Morgan
5168d136ed lib: multiBalanceReport: Enable --drop for tree mode. 2020-06-22 22:28:08 +10:00
Stephen Morgan
fcaec1540a lib: multiBalanceReport: Remove unnecessary addition of parent accounts. 2020-06-22 22:27:11 +10:00
Stephen Morgan
e079c8b808 lib: multiBalanceReport: Remove old balanceReport code, update some tests. 2020-06-22 22:27:09 +10:00
Stephen Morgan
edb28d51c5 lib: multiBalanceReport: Get boring parent ellision working for multiBalanceReport. 2020-06-22 22:25:23 +10:00
Stephen Morgan
cd41404fd4 lib: multiBalanceReport: Get --drop working with multiBalanceReports. 2020-06-22 22:21:31 +10:00
Stephen Morgan
6467c252c7 lib: multiBalanceReport: Move responsibility for display name into displayedAccounts 2020-06-22 22:21:30 +10:00
Stephen Morgan
5f0918217a multibalanceReport: Move responsibility for determining displayed name in multiBalanceReportWith, not at point of consumption. 2020-06-22 22:20:09 +10:00
Stephen Morgan
0dedcfbe15 lib: multiBalanceReport: Miscellaneous simplifications. 2020-06-22 22:11:54 +10:00
Stephen Morgan
1e7e80504f lib: multiBalanceReport: Keep Account around longer so we can use both aibalance and aebalance. 2020-06-22 22:10:24 +10:00
Stephen Morgan
0e89a389d6 lib: multiBalanceReport: Split displayedAccounts, calculateReportQuery into separate functions. 2020-06-22 22:07:55 +10:00
Stephen Morgan
b106850391 lib: multiBalanceReport: Split postprocessReport and calculateTotalsRow into separate functions. 2020-06-22 21:59:15 +10:00
Stephen Morgan
baa5844d4e lib: multiBalanceReport: Change indentation. 2020-06-22 21:54:38 +10:00
Stephen Morgan
0b30b2f9fb lib: multiBalanceReport: Split sortRows into a separate function. 2020-06-22 21:51:38 +10:00
Stephen Morgan
7a9bf998e5 lib: multiBalanceReport: Split buildReportRows into a separate function, remove unnecessary query and valuation. 2020-06-22 21:50:27 +10:00
Stephen Morgan
a81c6d0397 lib: multiBalanceReport: Split accumValueAmounts into a separate function. 2020-06-22 21:48:20 +10:00
Stephen Morgan
b2bed03b4c lib: multiBalanceReport: Don't import BalanceReport in MultiBalanceReport. 2020-06-22 21:45:42 +10:00
Stephen Morgan
0dcfddd201 lib: multiBalanceReport: Break calculateAccountChanges and acctChangesFromPostings separate functions. 2020-06-22 21:43:30 +10:00
Stephen Morgan
a72c4f285b lib: multiBalanceReport: Break calculateColumns into a separate function. 2020-06-22 21:39:41 +10:00
Stephen Morgan
fc6a30b234 lib: multiBalanceReport: Break calculateColSpans into a separate function. 2020-06-22 21:38:16 +10:00
Stephen Morgan
44dcd613e8 lib: multiBalanceReport: Break getPostings and makeReportQuery into separate functions. 2020-06-22 21:36:30 +10:00
Stephen Morgan
f21bf53610 lib: multiBalanceReport: Break startingBalances into separate function. 2020-06-22 21:33:16 +10:00
Simon Michael
e3cae4aadc valuation: implement new --infer-value flag & semantics (#1239, #1253) 2020-06-19 14:40:20 -07:00
Simon Michael
06d5014f5f ;lib: multibalancereport: apply debug output policy 2020-06-16 21:00:08 -07:00
Simon Michael
684cb45e1a tweak debug levels, document some guidelines
Beginnings of a project-wide policy for what output to show at
each debug level, for now. Later we'll want more flexibility,
eg filtering by topic.
2020-06-14 17:17:09 -07:00
Dmitry Astapov
b7413edf22 lib: --forecast=PERIODICEXPR. Fixes #835, #1236 2020-06-03 15:53:00 -07:00
Simon Michael
97f2235bca ;lib: refactor amount cost functions
Rename costOfAmount -> amountCost, costOfMixedAmount -> mixedAmountCost,
drop amountToCost, mixedAmountToCost.
2020-05-31 15:48:08 -07:00
Simon Michael
660ba7e1d9 lib: clarify zero-checking function names
isZeroAmount                -> amountLooksZero
isReallyZeroAmount          -> amountIsZero
isZeroMixedAmount           -> mixedAmountLooksZero
isReallyZeroMixedAmount     -> mixedAmountIsZero
isReallyZeroMixedAmountCost dropped
2020-05-29 18:57:22 -07:00
Dmitry Astapov
cbacef21eb lib: multiBalanceReport derives query from ReportOpts 2020-05-25 15:50:14 -07:00
Simon Michael
2a5f7819af bs,cf,is,bal,print,reg: support json output format 2020-02-24 17:49:53 -08:00
Simon Michael
7f16d23898 ;refactor: extract --value=then error message 2020-02-24 17:49:53 -08:00
Simon Michael
ae9d8d6e56 ;add then and t to --value's error message
[ci skip]
2020-02-10 12:40:02 -08:00
Simon Michael
aa96b41efe print, register: add --value=then, valuing at each posting's date
Currently this will give an error with other kinds of report.
2020-02-10 08:20:39 -08:00
Stephen Morgan
228edf6ba6 Don't store leaf name in PeriodReport.
Calculate at the point of consumption instead.
2020-01-04 21:15:42 -08:00
Stephen Morgan
2e20d0717f lib: Generalise PeriodicReport to be polymorphic in the account labels. 2020-01-04 17:23:17 -08:00
Stephen Morgan
88dc619257 lib: Use records instead of tuples in PeriodicReport. 2020-01-04 17:23:17 -08:00
Stephen Morgan
beb8b6d7c8 lib: Use PeriodicReport in place of MultiBalanceReport. 2020-01-04 17:23:17 -08:00
Stephen Morgan
74778efcf5 Use nubSort instead of nub . sort. 2020-01-04 08:31:10 -08:00
Stephen Morgan
38904372b2 Calculate MultiReportBalance columns more efficiently.
Only calculate posting date once for each posting, and calculate their
columns instead of checking each DateSpan separately.
2020-01-03 16:11:46 -08:00
Simon Michael
47567cd770 ;fix some warnings with GHC 8.10 alpha
hledger is GHC 8.10 ready!
2019-12-14 17:30:19 -08:00
Simon Michael
2b2a0b3cf8 ;tests: use "test" alias for testCase everywhere
Easier to type and read, and a little clearer to my eyes;
"testCase" implies a single case, but it can contain many assertions.
2019-11-28 15:33:33 -08:00
Simon Michael
b36f6df110 tests: port all unit tests to tasty, second pass (#1090)
Hledger.Util.Tests helpers have been cleaned up, and test names are
now shown.

Tests have been cleaned up a bit. Some groups of unnamed tests have
been collapsed into a single named test containing a sequence of
assertions. The test command counts named tests, not assertions, so
the reported unit test count has dropped from 199 to 188.
2019-11-27 13:17:34 -08:00
Simon Michael
13a3542464 tests: port all unit tests to tasty, first cut (#1090)
easytest is not actively maintained and requires an old version of
hedgehog which does not support base-compat 0.11 & ghc 8.8.

This is still using the old easytest helpers, and not displaying test
names properly.
2019-11-27 12:43:43 -08:00
Simon Michael
332624f9fa ui: B and V keys toggle display of cost, value 2019-11-21 17:33:04 -08:00
Mykola Orliuk
5287fe671b ;all: hide RawOpts internals
This way we can ensure we always use only functions from RawOptions.
2019-11-18 17:38:39 -08:00
Simon Michael
4cb2a03f7f ;lib: more docs for unifyMixedAmount
[ci skip]
2019-11-18 17:22:42 -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
Simon Michael
2e3b51c03f ;lib: journalConvertAmountsToCost -> journalToCost 2019-10-19 19:58:27 -07:00
Simon Michael
905149df86 ;lib: transaction valuation helpers 2019-10-19 19:41:21 -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
Dmitry Astapov
e9d300bef3 lib: dont raise when there is neither budget nor transactions in the report period 2019-09-11 16:09:28 -07:00
Dmitry Astapov
cf74972148 bin: improve debug output for budger report (show budget txns) 2019-09-11 16:09:28 -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
1cbbe8f43d memoise market valuation, making it fast (#999) 2019-08-19 02:16:39 +01:00
Simon Michael
70986769ef ;lib: derive NFData for MultiBalanceReport, PriceGraph for criterion
Allow these to be timed with criterion at ghci prompt.
2019-08-01 18:31:39 +02:00
Simon Michael
d193d757ea ;lib: multiBalanceReport: fix error message typo 2019-08-01 18:22:14 +02:00
Simon Michael
02ed4f5d04 ;lib: intervalFromRawOpts: replace undefined with an error message 2019-07-25 10:46:45 +01:00
Caleb Maclennan
11d9e5eb6a code: Strip extraneous trailing whitespace from Haskell sources 2019-07-15 16:40:49 +01:00
Simon Michael
5c3e4de647 ;lib: periodFromRawOpts: clarify doc (#1011)
[ci skip]
2019-07-01 18:33:18 +01:00
Jakob Schöttl
e483faf7f0 Bugfix for #1011: begin/end date options 2019-06-30 10:38:06 +02:00
Simon Michael
7dd0c5783a ;lib: multibalancereport: refactor 2019-06-14 19:04:09 -07:00
Simon Michael
baa15d9bea ;lib: rename MultiBalanceReports.hs -> MultiBalanceReport.hs 2019-06-14 11:45:25 -07:00
Simon Michael
692620180e ;lib: refactor: change AmountPrice to a Maybe
I've wanted to do this for a long time; now that prices are in flux,
seems a good time.
2019-06-13 15:50:01 -07:00
Simon Michael
adb6ee40eb lib: clarify price types (#131)
dropped journalPrices

renamed Price to AmountPrice,  AKA "transaction price"

renamed MarketPrice to PriceDirective.

added new MarketPrice (more pure form of PriceDirective without the amount style information)

Prices is now a more efficient data structure, but not used yet.
2019-06-13 15:50:01 -07:00
Simon Michael
e24c6292d0 lib: support -X/--exchange (direct/reverse prices only) (#131) 2019-06-13 15:50:01 -07:00
Simon Michael
6b6c3385c9 lib: parse optional ,COMM suffix in --value (#131) 2019-06-13 15:50:01 -07:00
Henning Thielemann
4962b2696a lib: accountTransactionsReportItems: rewrite using catMaybes and mapAccumL
I find the report function less convolved without the integrated recursion.
2019-06-09 18:45:58 -07:00
Simon Michael
42ce95aaef ; refactor: centralise valuation logic #131 2019-05-31 15:29:09 -07:00
Simon Michael
ad83919c6a ; lib: drop the Maybe from SummaryPosting 2019-05-31 15:29:09 -07:00
Simon Michael
34a0ad00b1 ;lib: encapsulate Prices db 2019-05-25 05:29:34 -07:00
Simon Michael
aa99743096 make -V do --value=end in multiperiod reports (#329) 2019-05-24 10:30:35 -07:00
Simon Michael
ea5050963f web: try to fix RegisterR warning 2019-05-23 22:34:31 -07:00
Simon Michael
20bc386b80 restore TransactionsReport
hledger-web's register chart uses it, I didn't see it
because it's called from a hamlet template.
2019-05-23 22:15:40 -07:00
Simon Michael
7212b92079 cleanups (#329) 2019-05-23 22:07:50 -07:00
Simon Michael
54c1529638 lib: drop TransactionsReport, BalanceHistoryReport
They seem unused.
2019-05-23 21:55:19 -07:00
Simon Michael
04a30fa084 lib: TransactionsReport/AccountTransactionsReport cleanup
Split them into separate files, rename journalTransactionsReport to
transactionsReport.
2019-05-23 21:55:19 -07:00
Simon Michael
9977739c76 bal etc.: replace --value=transaction with --value=cost (#329) 2019-05-23 21:55:18 -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
2355da0f93 reg: replace --value=transaction with --value=cost 2019-05-23 21:55:18 -07:00
Simon Michael
ace215f5f3 print: replace --value=transaction with --value=cost 2019-05-23 21:55:18 -07:00
Simon Michael
37c0edb1f9 lib: drop postingValueAtDate 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
e5339218f7 lib: valueTypeFromOpts helper 2019-05-09 15:36:26 -07:00
Simon Michael
d15869f855 ;doc: typo
[ci skip]
2019-05-09 12:22:48 -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
2ffe7914be ;improve valuation code docs 2019-05-07 16:19:49 -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
2ba0281335 bal: fix --value-at for old-style single period balance reports (#329) 2019-05-05 10:51:07 -07:00
Simon Michael
629b590de1 ;lib: cleanup 2019-05-05 10:38:13 -07:00
Simon Michael
1ad82d5b77 ;lib: balanceReport cleanup 2019-05-05 09:57:03 -07:00
Simon Michael
f4b0381043 ;lib: more docs for balanceReport 2019-05-05 09:50:29 -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
74c381cc88 ;lib: more docs for multiBalanceReport 2019-05-04 17:46:52 -07:00
Simon Michael
66b1599058 ;lib: postingsReport cleanup 2019-05-04 17:09:16 -07:00
Simon Michael
cc05f48697 ;lib: multiBalanceReport cleanup 2019-05-04 12:34:59 -07:00
Simon Michael
12c0bfb39b ;lib: brValue cleanup 2019-05-04 12:22:00 -07:00
Simon Michael
ec1b98434c reg: support --value-at=period with periodic reports (#329) 2019-05-04 12:22:00 -07:00
Simon Michael
dd8c403c81 ;cli: option help tweaks 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
Simon Michael
696e3098c8 reg: support --value-at in register reports; cleanups, tests 2019-04-26 12:08:46 -07:00
Simon Michael
7306e61646 bal: support --value-at in single column balance reports 2019-04-26 12:08:32 -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
9d3eb8c069 bal, reg, print: -V prefers non-future valuation dates again (#999) 2019-04-24 08:31:21 -07:00
Simon Michael
ef9c4a29c4 lib: save the current date in ReportOpts
We need this for choosing a valuation date, otherwise, report
functions would have to be in IO or we'd have to pass in yet another
argument.

It's optional because it's useful to be able to create report opts
purely (I think ?) This is not ideal but maybe not a problem.
2019-04-24 08:25:55 -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
Jakob Schöttl
4444b8bc8f Change unused argument to undefined to make possible bugs more obvious 2019-04-18 22:38:41 +02:00
Jakob Schöttl
593ee39284 Fix behavior of options like -Mp2019
This fixes the issue #1008
2019-04-18 22:38:41 +02:00
Simon Michael
13dc1096a5 reg: test and fix for --average, broken since 1.12 (#1003) 2019-04-06 11:00:38 -07:00
Simon Michael
0bc16d4af6 lib, cli, web: rename porigin -> poriginal 2019-02-20 20:23:54 -08:00
Jakob Schöttl
161ca660dc Support register --invert option to negate amounts 2019-02-09 15:55:41 -08:00
Dmitry Astapov
f2aaaf3310 lib, cli: merge --show-unbudgeted into --empty 2019-01-25 12:53:09 -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
92e7370f1f lib: fix alignment in budget report 2019-01-24 14:56:22 -08:00
Simon Michael
6f36702141 lib: rename, reposition tprecedingcomment field 2019-01-05 07:35:54 +00:00
Simon Michael
5908414d77 lib: amultiplier -> aismultiplier 2019-01-05 07:35:54 +00:00
Simon Michael
b053942e9b lib: flip the arguments of (divide|multiply)[Mixed]Amount (api change)
Also, start using a mapMixedAmount helper.
2018-11-13 17:28:24 -08:00
Simon Michael
74611a7be1 ui: accounts: fix balances when there's only periodic txns
And clarify multiBalanceReport.
2018-10-18 14:43:00 -07:00
Simon Michael
4a399e50cb acc: don't require an explicit --flat to make --drop work 2018-10-13 13:22:11 -07:00
Alex Chen
3d2584d869 lib: switch to megaparsec 7 2018-09-30 20:15:12 -06:00
Simon Michael
855bd54d19 budget: declaration and (actual) amount sorting for bal --budget
Account declaration-aware sorting is the default throughout hledger now.
2018-09-24 08:31:19 -10:00
Simon Michael
3de8c11de1 journal: a new account sorting mechanism, and a bunch of sorting fixes
A bunch of account sorting changes that got intermingled.

First, account codes have been dropped. They can still be parsed and
will be ignored, for now. I don't know if anyone used them.
Instead, account display order is now controlled by the order of account
directives, if any. From the mail list:

  I'd like to drop account codes, introduced in hledger 1.9 to control
  the display order of accounts. In my experience,

  - they are tedious to maintain
  - they duplicate/compete with the natural tendency to arrange account
    directives to match your mental chart of accounts
  - they duplicate/compete with the tree structure created by account
    names

  and it gets worse if you think about using them more extensively,
  eg to classify accounts by type.

  Instead, I plan to just let the position (parse order) of account
  directives determine the display order of those declared accounts.
  Undeclared accounts will be displayed after declared accounts,
  sorted alphabetically as usual.

Second, the various account sorting modes have been implemented more
widely and more correctly. All sorting modes (alphabetically, by account
declaration, by amount) should now work correctly in almost all commands
and modes (non-tabular and tabular balance reports, tree and flat modes,
the accounts command). Sorting bugs have been fixed, eg #875.
Only the budget report (balance --budget) does not yet support sorting.

Comprehensive functional tests for sorting in the accounts and balance
commands have been added. If you are confused by some sorting behaviour,
studying these tests is recommended, as sorting gets tricky.
2018-09-22 21:45:07 -10:00
Simon Michael
059ad9eb76 refactor: jaccounts -> jdeclaredaccounts 2018-09-17 05:52:13 -07:00
Simon Michael
8d3cddc907 drop another old csv import 2018-09-07 12:51:10 -07:00
Simon Michael
91b111b60d rename easytests_* to tests_* 2018-09-06 13:13:26 -07:00
Simon Michael
4003264129 lib: drop HUnit helpers, rename expectEqPP 2018-09-04 13:52:36 -07:00
Simon Michael
09d9fbf487 tests: Reports -> easytest 2018-09-04 12:23:07 -07:00
Simon Michael
241d0dbebd tests: ReportOptions -> easytest 2018-09-04 11:54:40 -07:00
Simon Michael
cd67f8ea68 tests: clear out old boilerplate 2018-08-31 18:12:17 -07:00
Simon Michael
d778a92561 tests: export HUnit/EasyTest from Hledger.Utils.Test; more helpers 2018-08-18 15:19:59 +01:00
Simon Michael
4d578c008f typo 2018-08-18 13:40:01 +01:00
Simon Michael
1e0a7ec8f1 remove some unneeded CPP pragmas 2018-08-02 08:25:49 +01:00
Simon Michael
9d2e80aa2c lib: Debug: simplify pprint, export ppShow as pshow (api change) 2018-07-16 12:51:50 +01:00
Simon Michael
816ba0f89d consistent comment wording 2018-06-18 17:54:25 -07:00
Simon Michael
061aad0431 remove some CPP that's obsolete since we require base 4.8+ 2018-06-04 17:33:21 -07:00
Simon Michael
1c6702d598 budget: note some todos
[ci skip]
2018-05-17 08:12:14 -07:00
Simon Michael
cfee04215f bal: always ignore --drop when not in flat mode (fix #754) 2018-05-05 16:12:27 -07:00
Simon Michael
9151f5004e budget: show a budget report even with no interval (for whole journal period) 2018-04-24 23:12:42 -07:00
Simon Michael
568a442307 budget: tweak hiding/grouping of unbudgeted accounts
It now works slightly differently. Eg:

- <unbudgeted>'s subaccounts are hidden by default
- --show-unbudgeted shows all unbudgeted accounts, including subaccounts of budgeted parents
- --show-unbudgeted doesn't affect the grouping under <unbudgeted>

IMHO it's a nice simplification and increase in consistency, while still meeting the original intent.
2018-04-24 13:42:12 -07:00
Simon Michael
8b650d8e4f budget: fix inconsistent hiding of unbudgeted accounts
Accounts which have no budget goals within the report period are now
grouped under <unbudgeted> - not just accounts with no budget goals ever.

Haddocks have been clarified, especially for budgetRollup. In some
ways things are much clearer without this feature, but it remains
enabled by default for now.
2018-04-23 18:52:28 -07:00
Simon Michael
8759f12b63 budget: more consistent display of percentage 2018-04-23 18:52:28 -07:00
Simon Michael
0c140d7238 budget: allow multi-interval budgets again
Budgets were restricted to a single interval in 1.9, but this was
a mistake. This restores the 1.5 behaviour, where a budget can be built
up from multiple periodic transactions with different intervals.
2018-04-23 18:52:28 -07:00
Simon Michael
e2c55aafa9 budget: --drop preserves the <unbudgeted> top-level account 2018-04-23 18:52:28 -07:00
Simon Michael
43287a3e26 budget: use a new first-class BudgetReport for --budget 2018-04-23 18:52:28 -07:00
Simon Michael
4b3c6afe75 lib: new generic PeriodicReport, and some report-related type aliases 2018-04-23 18:52:28 -07:00
Dmitry Astapov
f6ec26e321 lib, app, web, ui: rename readJournalFile[s]WithOpts to readJournalFile, same for tryReader[s]WithOpts 2018-04-17 15:25:02 -07:00
Dmitry Astapov
ecf49b1e4b lib: auto postings generated before amount inference and balance checks (#729) 2018-04-17 14:33:32 -07:00
Simon Michael
2b34ff1184 lib: reportSpan debug output 2018-03-30 02:41:03 +01:00
Simon Michael
ebaac2866b lib: fix reportStartEndDates, rename to reportSpan 2018-03-30 00:16:35 +01:00
Simon Michael
083d9190fd budget: only periodic txns with the selected interval are used 2018-03-29 15:51:52 +01:00
Simon Michael
d3fde29b36 bal: --invert flag to flip all signs 2018-01-29 14:53:23 -08:00
Simon Michael
9b88fc2ed0 bal/bs/cf/is: sort accounts by account code, if any, then account name
If any accounts have numeric codes assigned via account directives,
those accounts will be listed first, lowest account codes first.
2018-01-23 11:33:24 -08:00
Simon Michael
88ef586480 lib: rename, clarify purpose of balanceReportFromMultiBalanceReport 2018-01-23 11:32:24 -08:00
Simon Michael
6b349e3123 bs/bse/cf/is: show all balances as normally-positive (experimental)
Income, liability and equity balances, which until now we have
always displayed as negative numbers, are now shown as normally positive
by these reports.
Negative numbers now indicate a contra-balance (eg an overdrawn
checking account), a net loss, a negative net worth, etc.
This makes these reports more like conventional financial statements,
and easier to read and share with normal people.
2018-01-18 11:01:07 -08:00
Simon Michael
79812f974a rename NormalBalance -> NormalSign 2018-01-15 14:12:38 -08:00
Simon Michael
8f55b6137d uses today's prices, not those of last txn date, for -V (fix #683,#648) 2017-12-29 21:42:59 -08:00
Simon Michael
69e255cead lib: deduplicate, refactor valuation code 2017-12-29 16:52:08 -08:00
Dmitry Astapov
23f3da4e92 cli: --auto adds automated postings to reports
Ledger-style automated postings, previously supported only by
hledger-budget, have landed as a first-class feature.  The --auto
flag activates them, so that any postings they generate are
included in reports.
2017-11-26 14:57:41 +00:00
Dmitry Astapov
f101d5b515 cli: --forecast adds periodic transactions to reports
Ledger-style periodic transactions, previously supported only by
hledger-budget, have landed as a first-class feature.  The --forecast
flag activates them, so that any transactions they generate are
included in reports.
2017-11-26 14:57:41 +00:00
Simon Michael
b5602fd771 bal: --sort-amount sorts tree-mode multi-column balance reports 2017-09-29 18:49:47 -10:00
Simon Michael
d527384261 bal: --sort-amount sorts tree-mode single-column balance reports too 2017-09-28 09:49:03 -10:00
Simon Michael
cd998e7f2f slight fix for --sort-amount, don't flip when normal balance unspecified 2017-09-25 19:10:21 -10:00
Simon Michael
d9d92b3bf1 bs/bse/is: --sort-amount puts large liabilities/equities/incomes at top
Compound balance commands like these can now be aware of normal account
balance sign, and sort negative balances accordingly.

This also adds utility-ht as a dependency, only for the uncurry function
right now but it looks potentially useful to have.
2017-09-25 19:06:38 -10:00