Commit Graph

2774 Commits

Author SHA1 Message Date
Stephen Morgan
ddba9f6ce4 imp: lib,cli: Implement gain report for balance reports.
A gain report will report on unrealised gains by looking at the
difference between the valuation of an amount (by default, --value=end),
and the valuation of the cost of the amount.
2021-08-18 21:44:30 -10:00
Arjen Langebaerd
3426030a91 feat: added commodity style commandline option 2021-08-17 22:05:29 -10:00
Simon Michael
5c18fb289f ;dev: configure hlint, silence all current warnings 2021-08-11 14:51:46 -10:00
Simon Michael
04812682e8 ;doc: bump man page dates 2021-08-08 09:39:20 -10:00
Lawrence
5989ca0381 fix: skip budget grand total and average if they look zero
Makes them consistent with the remaining cells and fixes awkward
alignment issue in commodity-column mode where we don't display
anything
2021-08-08 09:19:25 -10:00
Lawrence
234caae557 doc: test: update for commodity-column
Add documentation and sample output for `--commodity-column` behavior
and functional tests e.g single-period balance, yearly balance, and
yearly budget
2021-08-08 09:19:25 -10:00
Lawrence
198d2211fc budget: option to view one commodity per row
Extension of commodity-column to budget reporting.
2021-08-08 09:19:25 -10:00
Lawrence Wu
f3c07144a8 bal: option to view one commodity per row
This adds the `--commodity-column` option that displays each commodity
on a separate line and the commodities themselves as a separate column.
The initial design considerations are at
simonmichael.hledger.issues.1559

The single-period balance report with `--commodity-column` does not
interoperate with custom formats.
2021-08-08 09:19:25 -10:00
Simon Michael
233b8c91cb ;doc: finalise 1.22.2 changelogs 2021-08-07 09:27:20 -10:00
Simon Michael
2e28c5a1ef ;doc: update changelogs 2021-08-07 09:20:20 -10:00
Simon Michael
9bc77f87fc ;doc: changelogs 2021-08-06 17:26:37 -10:00
Simon Michael
981849a6c1 ;doc: changelogs 2021-08-06 00:16:20 -10:00
Stephen Morgan
918c243fa9 fix: forecast: Generate forecast transactions at journal finalisation,
rather than as a postprocessing step. (#1638)

This allows us to have a uniform procedure for balancing transactions,
whether they are normal transactions or forecast transactions, including
dealing with balance assignments, balance assertions, and auto postings.
2021-08-05 21:10:47 -10:00
Stephen Morgan
c404800fbf ref!: forecast: Move forecast_ from ReportOpts to InputOpts. 2021-08-05 21:10:47 -10:00
Stephen Morgan
5cca04cdc9 imp: areg: aregister no longer excludes future/forecast transactions by default.
To get the previous behaviour, you can call with the additional query "not📅tomorrow-".

This is because we are preparing to move forecast_ to InputOpts, where
it is not accessible to AccountTransactionsReport.
2021-08-05 21:10:47 -10:00
Stephen Morgan
23b0cad6ef fix: areg: Make sure aregister sorts first by transaction register date,
then by parse order to break any ties. (#1642)
2021-08-05 20:49:25 -10:00
Simon Michael
6afc5ce6b2 ;cabal: update cabal files 2021-08-03 21:05:29 -10:00
Simon Michael
f51ea92cfc deps: require base >=4.11, prevent red squares on hackage matrix
We officially support GHC 8.6+ (and 8.8+ for hledger-web) now.
Hackage matrix builder shows all packages building successfully
with GHC 8.4+, somehow, so we'll adjust the base bound to
allow that but prevent any attempts to build with older GHCs,
2021-08-03 21:05:02 -10:00
Simon Michael
2a39497e21 pkg: add tested-with GHC 9.0.1 2021-08-03 20:52:05 -10:00
Simon Michael
abd63db3e7 ;doc: update changelogs 2021-08-03 09:50:57 -10:00
Simon Michael
95de5a878a ;cabal: update cabal files 2021-08-03 08:00:22 -10:00
Simon Michael
6665ddfb9b ;pkg: bump version to 1.22.99 2021-08-03 00:24:20 -10:00
Simon Michael
d425ce8fd3 ;doc: changelogs: 1.22.1 release date 2021-08-02 22:50:03 -10:00
Stephen Morgan
ae3c7e8756 fix: areg: Make sure the true original transaction is made available in
AccountTransactionsReport.

Only a limited number of journal transformations are allowed in
accountTransactionReports due to the need to include the original
transaction. Document these.

Make sure to remove currency and amount queries from the reportq, so
they do not cause problems after valuation.

Avoid confusion by calculating transaction date at one point, and
passing that down with the transaction.
2021-08-02 22:47:50 -10:00
Stephen Morgan
b7e40a9e63 ref: areg: Avoid reversing transactions list by making sure we sort them
in the correct order to start with.
2021-08-02 22:47:50 -10:00
Stephen Morgan
4e0dcec096 fix: areg: Explicitly avoid filtering by depth queries, perform
valuation after all reportq filtering is done (in both the historical
and recent postings), and make sure filtering is done at the correct
point based on whether --txn-dates is set. (#1634)
2021-08-02 22:47:50 -10:00
Simon Michael
1d0b2bf9ce ;doc: update changelogs 2021-08-01 08:05:05 -10:00
Stephen Morgan
fc8aa602cf lib!: modifyTransactions now takes a Map of commodity styles, and will
style amounts according to that argument. journalAddForecast and
journalTransform now return an Either String Journal.

This improves efficiency, as we no longer have to restyle all amounts in
the journal after generating auto postings or periodic transactions.
Changing the return type of journalAddForecast and journalTransform
reduces partiality.

To get the previous behaviour for modifyTransaction, use modifyTransaction mempty.
2021-07-30 13:52:35 -10:00
Stephen Morgan
04a36d4942 ref: Refactor journalFinalise to clarify flow.
The only semantic difference is that we now apply
journalApplyCommodityStyles before running journalCheckAccountsDeclared
and journalCheckCommoditiesDeclared.
2021-07-30 13:52:35 -10:00
Stephen Morgan
c537f9426b dev: lens: Use lenses for updateReportSpec(With). 2021-07-30 09:27:39 -10:00
Stephen Morgan
4e9db4e377 dev: lens: Introduce lenses for ReportOpts and ReportSpec. 2021-07-30 09:27:39 -10:00
Simon Michael
2f819725e5 ;lib: accountTransactionsReport: clarify 2021-07-30 09:09:49 -10:00
Stephen Morgan
9df574b3c0 fix: reg: register --related should not create duplicate postings when
more than one posting in a transaction matches. (#1629)
2021-07-30 09:06:27 -10:00
Stephen Morgan
6528f25593 fix: lib: Filter postings before performing valuation and costing in
MultiBalanceReport, PostingsReport, EntriesReport, and
AccountTransactionsReport. (#1625, #1630)
2021-07-30 09:06:27 -10:00
Simon Michael
78e9f8877c ;doc: changelogs: lib edits 2021-07-28 14:48:17 -10:00
Simon Michael
e4a23c95d4 ;doc: changelogs: gather 1.22.1 changes 2021-07-28 10:03:22 -10:00
Simon Michael
666e217bd5 ;doc: update changelogs 2021-07-27 23:21:13 -10:00
Simon Michael
d2b799a717 feat: bal: select budget( transaction)s by name (#1612)
This makes it possible to keep multiple named budgets in one journal,
and select the one you want with --budget's argument.

More precisely, you can select the subset of periodic transactions
rules which contain a certain fixed, case-insensitive substring.

Only one such --budget argument is supported, the last one on the
command line takes precedence.
2021-07-23 10:38:20 -10:00
Stephen Morgan
b0aa70b27a lib!: Rename the fields of ReportSpec.
This is done to be more consistent with future field naming conventions,
and to make automatic generation of lenses simpler. See discussion in
\#1545.

rsOpts -> _rsReportOpts
rsToday -> _rsDay
rsQuery -> _rsQuery
rsQueryOpts -> _rsQueryOpts
2021-07-23 10:37:08 -10:00
Stephen Morgan
7ed2a0aa9b lib!: lib: Remove aismultiplier from Amount.
In Amount, aismultiplier is a boolean flag that will always be False,
except for in TMPostingRules, where it indicates whether the posting
rule is a multiplier. It is therefore unnecessary in the vast majority
of cases. This posting pulls this flag out of Amount and puts it into
TMPostingRule, so it is only kept around when necessary.

This changes the parsing of journals somewhat. Previously you could
include an * before an amount anywhere in a Journal, and it would
happily parse and set the aismultiplier flag true. This will now fail
with a parse error: * is now only acceptable before an amount within an
auto posting rule.

Any usage of the library in which the aismultiplier field is read or set
should be removed. If you truly need its functionality, you should
switch to using TMPostingRule.

This changes the JSON output of Amount, as it will no longer include
aismultiplier.
2021-07-22 19:06:33 -10:00
Stephen Morgan
3969eb2679 lib!: lib,cli,ui,web: For accountTransactionsReport, generate the overall
reportq from the ReportSpec, rather than being supplied as a separate
option.

This is the same approach used by the other reports, e.g. EntryReport,
PostingReport, MultiBalanceReport. This reduces code duplication, as
previously the reportq had to be separately tweaked in each of 5
different places.

If you call accountTransactionreport, there is no need to separately
derive the report query.
2021-07-22 19:00:37 -10:00
Stephen Morgan
f673e7c2eb lib!: lib,web: Remove unused TransactionReport. Move the useful utility
functions to AccountTransactionsReport.

If you use transactionsReport, you should either use entryReport if you
don't require a running total, or using accountTransactionsReport with
thisacctq as Any or None (depending on what you want included in the
running total).
2021-07-22 19:00:37 -10:00
Stephen Morgan
58516eea77 imp: json: Decrease indentation in JSON output. 2021-07-20 23:28:18 -10:00
Simon Michael
6569c2aca7 ;doc: update changelogs 2021-07-20 22:24:39 -10:00
Simon Michael
861c34484e test: skip doctests with GHC 9 for now (#1503, #1615) 2021-07-20 20:38:39 -10:00
Simon Michael
3ef9958041 test: doctest cleanups, use latest 2021-07-20 20:38:39 -10:00
Simon Michael
9aac520edd deps: allow megaparsec 9.1 2021-07-20 20:38:39 -10:00
Stephen Morgan
c606f874fb imp: json: The keys of JSON objects are now displayed in alphabetical order, making it stable across different systems and compilers. 2021-07-20 20:37:33 -10:00
Simon Michael
87f575e643 ref: bal: rename some report types to clarify/sync with docs
ReportType -> BalanceCalculation
 ChangeReport -> CalcChange
 BudgetReport -> CalcBudget
 ValueChangeReport -> CalcValueChange

BalanceType -> BalanceAccumulation
 PeriodChange -> PerPeriod
 CumulativeChange -> Cumulative
 HistoricalBalance -> Historical

ReportOpts:
 reporttype_ -> balancecalc_
 balancetype_ -> balanceaccum_

CompoundBalanceCommandSpec:
 cbctype -> cbcaccum

Hledger.Reports.ReportOptions:
 balanceTypeOverride -> balanceAccumulationOverride
2021-07-15 14:22:20 -10:00
Simon Michael
964a019368 ;doc: changelogs: minor release headings 2021-07-13 18:39:43 -10:00