Commit Graph

1584 Commits

Author SHA1 Message Date
Stephen Morgan
dc41cee2b0 lib: datep now requires years to be at least four digits. 2020-07-31 17:22:27 -07:00
Stephen Morgan
ffb5cf0773 lib: Ensure parsed years have at least 4 digits. 2020-07-31 17:22:27 -07:00
Stephen Morgan
7b9f9ae49c lib: Refactor reportingintervalp to be more compact and do less backtracking. 2020-07-31 17:22:27 -07:00
Stephen Morgan
696d9c73b0 lib: Remove unnecessary try in parsers, replace unnecessary string' with string, rewrite some parsers in applicative style. 2020-07-31 17:22:27 -07:00
Dmitry Astapov
a82c383370 lib: disallow tabs in simplecommoditysymbolp (fixes #1301) 2020-07-28 15:33:47 -07:00
Stephen Morgan
081ee390ab lib: Change skipMany spacenonewline to takeWhileP Nothing isNonNewlineSpace. 2020-07-22 14:58:53 -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
Simon Michael
e4f8b80d3b ;journal: account types: fix detection of Cash as an Asset, add tests 2020-07-17 10:02:14 -07:00
Simon Michael
fd9171df07 journal: account types: add Cash, tweak fallback regexp, rewrite docs 2020-07-17 08:02:12 -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
Stephen Morgan
dc076b0d5b lib: Use text library functions for stripping. 2020-07-16 10:03:25 -07:00
Stephen Morgan
ed99aea7d5 lib: Introduce takeEnd to get rid of some reverse . take n . reverse. 2020-07-16 10:03:25 -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
bf2fe3d88e ;lib: valuation debug output note 2020-07-14 10:21:45 -07:00
Simon Michael
febd8bb457 lib: postingsReport: follow debug levels policy 2020-07-13 11:53:05 -07:00
Stephen Morgan
fd729beabf lib: Work around hiding deprecation warnings, don't traverse zeros twice in normaliseHelper. 2020-07-10 12:18:51 -07:00
Stephen Morgan
ee3ed6acdf lib: Simplify and speed up amountLooksZero. 2020-07-10 12:18:51 -07:00
Stephen Morgan
99b74dc389 lib: Refactor sortAccountTreeByAmount 2020-07-10 09:08:03 -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
4b9a76068f lib: spanStartYear, spanEndYear, spanYears DateSpan helpers 2020-07-09 12:52:40 -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
Michael Sanders
5ec0a518da csv: Add support for & operators in conditional blocks 2020-07-07 12:51:01 -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
Simon Michael
2739a70a38 balcmds: elide amounts with 3 or more commodities, unless --no-elide
Multicolumn balance reports showing many commodities tend to become
unreadably wide, especially in tree mode. Now by default we show at
most two commodities, and a count of the rest if there are more than
two. This should help keep reports somewhat readable by default.
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
Simon Michael
765fb732c9 debug: move command parsing debug output down to level 8 2020-07-03 11:37:01 -07:00
Simon Michael
6cc896a8fe debug: show aliasing and auto postings with other reading (level 7) 2020-07-03 11:30:52 -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
b3cd865786 lib: Add fortnightly as a synonym for biweekly. 2020-06-23 06:48:20 -07:00
Simon Michael
e0fab4f882
Merge pull request #1256 from Xitian9/balanceReport
SMorgan: 
This PR aims to accomplish two major goals:

-    Get boring parent ellision working for multiBalanceReport
-    Remove the special BalanceReport code, and just use multiBalanceReport

I believe it does both, with the following additional benefits:

    A refactor of multiBalanceReportWith, to make the structure easier to follow, and with a clearer division of responsibilities
    All decisions for how an account name is to be displayed are now made in multiBalanceReport, rather than scattered around the code base
    Some miscellaneous improvements in account name rendering, including --drop now working with MultiBalanceReports, and addressing some of #373

Algorithmic changes:

-    Using HashMap AccountName (Map DateSpan Account) instead of [[MixedAmount]] is new. I admit I didn't profile this change (though given the nubs and lookups, I thought it was appropriate), so I'm glad it produces a speedup.
-    Producing the starting balances no longer calls the whole balanceReport, just the first few functions to get what it needs.
-    displayedAccounts is completely rewritten. Perhaps one subtle thing to note is that in tree mode it no longer excludes nodes with zero inclusive balance unless they also have zero exclusive balance.

SMichael: 
I'll mark the passing of the old multiBalanceReport, into which I poured many an hour :). It is in a way the heart (brain ?) of hledger - the key feature of ledgerlikes (balance report) and a key improvement introduced by hledger (tabular multiperiod balance reports). You have split that 300-line though well documented function into modular parts, which could be a little harder to understand in detail but are easier to understand in the large and more amenable to further refactoring. Then you fixed some old limitations (boring parent eliding in multi period balance reports, --drop with tree mode reports), allowing us to drop the old balanceReport and focus on just the new multiBalanceReport. And for representing the tabular data you replaced the semantically correct but inefficient list of lists with a map of maps, speeding up many-columned balance reports significantly (~40%). Last and not least you made it really easy to review. Thanks @Xitian9, great work.
2020-06-23 06:42:22 -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
7a74fc4f21 lib: Elide account if more components are dropped than exist. 2020-06-22 13:41:22 -07:00