ui: show historical balances whenever possible #392
hledger-ui now tries to show historical balances always, including when (to limit transactions on the register screen) a report start date is specified. This means that: - the accounts screen balances are not disturbed by a start date - the register screen is now a little better at showing the running historical balance. It's still not very good at it; some filter queries will cause it to fall back to showing the running total of visible transactions. But it's no longer disturbed by Z (nonzero mode) or a cur: query term.
This commit is contained in:
parent
47695f6484
commit
11c6426834
@ -68,10 +68,7 @@ asInit d reset ui@UIState{
|
|||||||
mexactmatch = findIndex ((a ==) . asItemAccountName) displayitems
|
mexactmatch = findIndex ((a ==) . asItemAccountName) displayitems
|
||||||
mprefixmatch = findIndex ((a `isAccountNamePrefixOf`) . asItemAccountName) displayitems
|
mprefixmatch = findIndex ((a `isAccountNamePrefixOf`) . asItemAccountName) displayitems
|
||||||
uopts' = uopts{cliopts_=copts{reportopts_=ropts'}}
|
uopts' = uopts{cliopts_=copts{reportopts_=ropts'}}
|
||||||
ropts' = ropts {
|
ropts' = ropts{accountlistmode_=if flat_ ropts then ALFlat else ALTree}
|
||||||
-- XXX balanceReport doesn't respect this yet
|
|
||||||
balancetype_=HistoricalBalance
|
|
||||||
}
|
|
||||||
|
|
||||||
q = queryFromOpts d ropts
|
q = queryFromOpts d ropts
|
||||||
|
|
||||||
@ -82,7 +79,7 @@ asInit d reset ui@UIState{
|
|||||||
valuedate = fromMaybe d $ queryEndDate False q
|
valuedate = fromMaybe d $ queryEndDate False q
|
||||||
|
|
||||||
-- run the report
|
-- run the report
|
||||||
(items,_total) = convert $ balanceReport ropts' q j
|
(items,_total) = convert $ singleBalanceReport ropts' q j
|
||||||
|
|
||||||
-- pre-render the list items
|
-- pre-render the list items
|
||||||
displayitem (fullacct, shortacct, indent, bal) =
|
displayitem (fullacct, shortacct, indent, bal) =
|
||||||
|
|||||||
@ -84,7 +84,9 @@ runBrickUi uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} j = do
|
|||||||
-- show items with zero amount by default, unlike the CLI
|
-- show items with zero amount by default, unlike the CLI
|
||||||
empty_=True,
|
empty_=True,
|
||||||
-- always disable boring account name eliding, unlike the CLI, for a more regular tree
|
-- always disable boring account name eliding, unlike the CLI, for a more regular tree
|
||||||
no_elide_=True
|
no_elide_=True,
|
||||||
|
-- always show historical balances, regardless of report start date
|
||||||
|
balancetype_=HistoricalBalance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user