fix: bal --budget --layout=tall was hiding commodity symbols

When reports want to render amounts without commmodity symbols,
they must now use AmountDisplayOpts' new displayCommodity flag.
(Previously it was a side effect of setting displayCommodityOrder.)
This commit is contained in:
Simon Michael 2023-12-07 14:41:19 -10:00
parent 0bc86c95e4
commit 51224f6e27
5 changed files with 70 additions and 84 deletions

View File

@ -223,7 +223,8 @@ data AmountDisplayOpts = AmountDisplayOpts
, displayZeroCommodity :: Bool -- ^ Whether to display commodity symbols for zero Amounts. , displayZeroCommodity :: Bool -- ^ Whether to display commodity symbols for zero Amounts.
, displayCommodityOrder :: Maybe [CommoditySymbol] , displayCommodityOrder :: Maybe [CommoditySymbol]
-- ^ For a MixedAmount, an optional order in which to display the commodities. -- ^ For a MixedAmount, an optional order in which to display the commodities.
-- Also causes 0s to be displayed for commodities which are not present. -- Also, causes 0s to be generated for any commodities which are not present
-- (important for tabular reports).
, displayDigitGroups :: Bool -- ^ Whether to display digit group marks (eg thousands separators) , displayDigitGroups :: Bool -- ^ Whether to display digit group marks (eg thousands separators)
, displayForceDecimalMark :: Bool -- ^ Whether to add a trailing decimal mark when there are no decimal digits , displayForceDecimalMark :: Bool -- ^ Whether to add a trailing decimal mark when there are no decimal digits
-- and there are digit group marks, to disambiguate -- and there are digit group marks, to disambiguate
@ -652,12 +653,12 @@ showAmount = wbUnpack . showAmountB noColour
showAmountB :: AmountDisplayOpts -> Amount -> WideBuilder showAmountB :: AmountDisplayOpts -> Amount -> WideBuilder
showAmountB _ Amount{acommodity="AUTO"} = mempty showAmountB _ Amount{acommodity="AUTO"} = mempty
showAmountB showAmountB
AmountDisplayOpts{displayCost, displayColour, displayZeroCommodity, AmountDisplayOpts{displayCommodity, displayZeroCommodity, displayDigitGroups
displayDigitGroups, displayForceDecimalMark, displayCommodityOrder} ,displayForceDecimalMark, displayCost, displayColour}
a@Amount{astyle=style} = a@Amount{astyle=style} =
color $ case ascommodityside style of color $ case ascommodityside style of
L -> showsym (wbFromText comm) space <> quantity' <> price L -> (if displayCommodity then wbFromText comm <> space else mempty) <> quantity' <> price
R -> quantity' <> showsym space (wbFromText comm) <> price R -> quantity' <> (if displayCommodity then space <> wbFromText comm else mempty) <> price
where where
color = if displayColour && isNegativeAmount a then colorB Dull Red else id color = if displayColour && isNegativeAmount a then colorB Dull Red else id
quantity = showAmountQuantity displayForceDecimalMark $ quantity = showAmountQuantity displayForceDecimalMark $
@ -667,11 +668,6 @@ showAmountB
| otherwise = (quantity, quoteCommoditySymbolIfNeeded $ acommodity a) | otherwise = (quantity, quoteCommoditySymbolIfNeeded $ acommodity a)
space = if not (T.null comm) && ascommodityspaced style then WideBuilder (TB.singleton ' ') 1 else mempty space = if not (T.null comm) && ascommodityspaced style then WideBuilder (TB.singleton ' ') 1 else mempty
price = if displayCost then showAmountPrice a else mempty price = if displayCost then showAmountPrice a else mempty
-- Show a commodity symbol and its optional space, concatenated.
-- Unless there's a commodity display order, in which case show nothing. XXX for --layout=bare, but wrong for --layout=tall
showsym l r
| isJust displayCommodityOrder = mempty
| otherwise = l <> r
-- | Colour version. For a negative amount, adds ANSI codes to change the colour, -- | Colour version. For a negative amount, adds ANSI codes to change the colour,
-- currently to hard-coded red. -- currently to hard-coded red.

View File

@ -324,10 +324,10 @@ budgetReportAsTable
padcells = maybetranspose . fmap (fmap (uncurry paddisplaycell) . zip widths) . maybetranspose padcells = maybetranspose . fmap (fmap (uncurry paddisplaycell) . zip widths) . maybetranspose
padtr = maybetranspose . fmap (fmap (uncurry paddisplaycell) . zip trwidths) . maybetranspose padtr = maybetranspose . fmap (fmap (uncurry paddisplaycell) . zip trwidths) . maybetranspose
-- commodities are shown with the amounts without `layout_ == LayoutBare` -- with --layout=bare, begin with a commodity column
prependcs cs prependcs cs
| layout_ /= LayoutBare = id | layout_ == LayoutBare = zipWith (:) cs
| otherwise = zipWith (:) cs | otherwise = id
rowToBudgetCells (PeriodicReportRow _ as rowtot rowavg) = as rowToBudgetCells (PeriodicReportRow _ as rowtot rowavg) = as
++ [rowtot | row_total_ && not (null as)] ++ [rowtot | row_total_ && not (null as)]
@ -337,9 +337,9 @@ budgetReportAsTable
rowfuncs :: [CommoditySymbol] -> (BudgetShowMixed, BudgetPercBudget) rowfuncs :: [CommoditySymbol] -> (BudgetShowMixed, BudgetPercBudget)
rowfuncs cs = case layout_ of rowfuncs cs = case layout_ of
LayoutWide width -> LayoutWide width ->
( pure . showMixedAmountB oneLine{displayColour=color_, displayMaxWidth=width} ( pure . showMixedAmountB oneLine{displayMaxWidth=width, displayColour=color_}
, \a -> pure . percentage a) , \a -> pure . percentage a)
_ -> ( showMixedAmountLinesB noCost{displayCommodityOrder=Just cs, displayMinWidth=Nothing, displayColour=color_} _ -> ( showMixedAmountLinesB noCost{displayCommodity=layout_/=LayoutBare, displayCommodityOrder=Just cs, displayMinWidth=Nothing, displayColour=color_}
, \a b -> fmap (percentage' a b) cs) , \a b -> fmap (percentage' a b) cs)
showrow :: [BudgetCell] -> [(WideBuilder, BudgetDisplayRow)] showrow :: [BudgetCell] -> [(WideBuilder, BudgetDisplayRow)]
@ -476,11 +476,11 @@ budgetReportAsCsv
| otherwise = | otherwise =
joinNames . zipWith (:) cs -- add symbols and names joinNames . zipWith (:) cs -- add symbols and names
. transpose -- each row becomes a list of Text quantities . transpose -- each row becomes a list of Text quantities
. fmap (fmap wbToText . showMixedAmountLinesB oneLine{displayCommodityOrder=Just cs, displayMinWidth=Nothing} . fmap (fmap wbToText . showMixedAmountLinesB dopts . fromMaybe nullmixedamt)
.fromMaybe nullmixedamt)
$ vals $ vals
where where
cs = S.toList . foldl' S.union mempty . fmap maCommodities $ catMaybes vals cs = S.toList . foldl' S.union mempty . fmap maCommodities $ catMaybes vals
dopts = oneLine{displayCommodity=layout_ /= LayoutBare, displayCommodityOrder=Just cs, displayMinWidth=Nothing}
vals = flattentuples as vals = flattentuples as
++ concat [[rowtot, budgettot] | row_total_] ++ concat [[rowtot, budgettot] | row_total_]
++ concat [[rowavg, budgetavg] | average_] ++ concat [[rowavg, budgetavg] | average_]

View File

@ -434,8 +434,11 @@ balanceReportAsCsv opts (items, total) =
showName = accountNameDrop (drop_ opts) showName = accountNameDrop (drop_ opts)
renderAmount amt = wbToText $ showMixedAmountB bopts amt renderAmount amt = wbToText $ showMixedAmountB bopts amt
where bopts = csvDisplay{displayCommodityOrder = order} where
order = if layout_ opts == LayoutBare then Just (S.toList $ maCommodities amt) else Nothing bopts = csvDisplay{displayCommodity=showcomm, displayCommodityOrder = commorder}
(showcomm, commorder)
| layout_ opts == LayoutBare = (False, Just $ S.toList $ maCommodities amt)
| otherwise = (True, Nothing)
-- | Render a single-column balance report as plain text. -- | Render a single-column balance report as plain text.
balanceReportAsText :: ReportOpts -> BalanceReport -> TB.Builder balanceReportAsText :: ReportOpts -> BalanceReport -> TB.Builder
@ -467,7 +470,7 @@ balanceReportAsText' opts ((items, total)) =
[ Cell TopRight damts [ Cell TopRight damts
, Cell TopLeft (fmap wbFromText cs) , Cell TopLeft (fmap wbFromText cs)
, Cell TopLeft (replicate (length damts - 1) mempty ++ [wbFromText dispname]) ] , Cell TopLeft (replicate (length damts - 1) mempty ++ [wbFromText dispname]) ]
where dopts = oneLine{displayColour=color_ opts, displayCommodityOrder=Just cs} where dopts = oneLine{displayCommodity=layout_ opts /= LayoutBare, displayCommodityOrder=Just cs, displayColour=color_ opts}
cs = if mixedAmountLooksZero amt then [""] else S.toList $ maCommodities amt cs = if mixedAmountLooksZero amt then [""] else S.toList $ maCommodities amt
dispname = T.replicate ((dep - 1) * 2) " " <> acctname dispname = T.replicate ((dep - 1) * 2) " " <> acctname
damts = showMixedAmountLinesB dopts amt damts = showMixedAmountLinesB dopts amt
@ -524,7 +527,12 @@ renderComponent topaligned oneline opts (acctname, dep, total) (FormatField ljus
| topaligned = TopRight | topaligned = TopRight
| ljust = BottomLeft | ljust = BottomLeft
| otherwise = BottomRight | otherwise = BottomRight
dopts = noCost{displayColour=color_ opts, displayOneLine=oneline, displayMinWidth=mmin, displayMaxWidth=mmax} dopts = noCost{displayCommodity = layout_ opts /= LayoutBare
,displayOneLine = oneline
,displayMinWidth = mmin
,displayMaxWidth = mmax
,displayColour = color_ opts
}
-- rendering multi-column balance reports -- rendering multi-column balance reports
@ -737,12 +745,12 @@ multiBalanceRowAsWbs bopts ReportOpts{..} colspans (PeriodicReportRow _ as rowto
$ allamts $ allamts
LayoutBare -> zipWith (:) (fmap wbFromText cs) -- add symbols LayoutBare -> zipWith (:) (fmap wbFromText cs) -- add symbols
. transpose -- each row becomes a list of Text quantities . transpose -- each row becomes a list of Text quantities
. fmap (showMixedAmountLinesB bopts{displayCommodityOrder=Just cs, displayMinWidth=Nothing}) . fmap (showMixedAmountLinesB bopts{displayCommodity=False, displayCommodityOrder=Just cs, displayMinWidth=Nothing})
$ allamts $ allamts
LayoutTidy -> concat LayoutTidy -> concat
. zipWith (map . addDateColumns) colspans . zipWith (map . addDateColumns) colspans
. fmap ( zipWith (\c a -> [wbFromText c, a]) cs . fmap ( zipWith (\c a -> [wbFromText c, a]) cs
. showMixedAmountLinesB bopts{displayCommodityOrder=Just cs, displayMinWidth=Nothing}) . showMixedAmountLinesB bopts{displayCommodity=False, displayCommodityOrder=Just cs, displayMinWidth=Nothing})
$ as -- Do not include totals column or average for tidy output, as this $ as -- Do not include totals column or average for tidy output, as this
-- complicates the data representation and can be easily calculated -- complicates the data representation and can be easily calculated
where where

View File

@ -708,3 +708,23 @@ Budget performance in 2022-01-01:
a || 1.0 [100% of 1.0] a || 1.0 [100% of 1.0]
---++------------------- ---++-------------------
|| 1.0 [100% of 1.0] || 1.0 [100% of 1.0]
# ** 38. Tall budget report adds per-column zeroes properly.
<
2020-01-15
(a) A 100
2020-02-15
(a) A 200
(b) B 200
$ hledger -f- bal --budget -M --layout=tall
Budget performance in 2020-01-01..2020-02-29:
|| Jan Feb
==============++==============
<unbudgeted> || A 100 A 200
<unbudgeted> || 0 B 200
--------------++--------------
|| A 100 A 200
|| 0 B 200

View File

@ -4,22 +4,18 @@
# ** 1. Balance report csv output with no commodity columns. # ** 1. Balance report csv output with no commodity columns.
$ hledger -f bcexample.hledger bal assets.*etrade -3 -O csv $ hledger -f bcexample.hledger bal assets.*etrade -3 -O csv
>
"account","balance" "account","balance"
"Assets:US:ETrade","70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT" "Assets:US:ETrade","70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT"
"total","70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT" "total","70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT"
>=0
# ** 2.
$ hledger -f bcexample.hledger bal assets.*etrade -3 -O tsv $ hledger -f bcexample.hledger bal assets.*etrade -3 -O tsv
>
account balance account balance
Assets:US:ETrade 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT Assets:US:ETrade 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT
total 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT total 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT
>=0
# ** 2. Balance report csv output with one line per commodity (--layout=bare). # ** 3. Balance report csv output with one line per commodity (--layout=bare).
$ hledger -f bcexample.hledger bal assets.*etrade -3 -O csv --layout=bare $ hledger -f bcexample.hledger bal assets.*etrade -3 -O csv --layout=bare
>
"account","commodity","balance" "account","commodity","balance"
"Assets:US:ETrade","GLD","70.00" "Assets:US:ETrade","GLD","70.00"
"Assets:US:ETrade","ITOT","17.00" "Assets:US:ETrade","ITOT","17.00"
@ -31,10 +27,9 @@ $ hledger -f bcexample.hledger bal assets.*etrade -3 -O csv --layout=bare
"total","USD","5120.50" "total","USD","5120.50"
"total","VEA","36.00" "total","VEA","36.00"
"total","VHT","294.00" "total","VHT","294.00"
>=0
# ** 4.
$ hledger -f bcexample.hledger bal assets.*etrade -3 -O tsv --layout=bare $ hledger -f bcexample.hledger bal assets.*etrade -3 -O tsv --layout=bare
>
account commodity balance account commodity balance
Assets:US:ETrade GLD 70.00 Assets:US:ETrade GLD 70.00
Assets:US:ETrade ITOT 17.00 Assets:US:ETrade ITOT 17.00
@ -46,11 +41,9 @@ total ITOT 17.00
total USD 5120.50 total USD 5120.50
total VEA 36.00 total VEA 36.00
total VHT 294.00 total VHT 294.00
>=0
# ** 3. Balance report output with no commodity column. # ** 5. Balance report output with no commodity column.
$ hledger -f bcexample.hledger bal assets.*etrade -3 $ hledger -f bcexample.hledger bal assets.*etrade -3
>
70.00 GLD 70.00 GLD
17.00 ITOT 17.00 ITOT
5120.50 USD 5120.50 USD
@ -62,11 +55,9 @@ $ hledger -f bcexample.hledger bal assets.*etrade -3
5120.50 USD 5120.50 USD
36.00 VEA 36.00 VEA
294.00 VHT 294.00 VHT
>=0
# ** 4. Balance report with commodity column. # ** 6. Balance report with commodity column.
$ hledger -f bcexample.hledger bal assets.*etrade -3 --layout=bare $ hledger -f bcexample.hledger bal assets.*etrade -3 --layout=bare
>
70.00 GLD 70.00 GLD
17.00 ITOT 17.00 ITOT
5120.50 USD 5120.50 USD
@ -78,26 +69,21 @@ $ hledger -f bcexample.hledger bal assets.*etrade -3 --layout=bare
5120.50 USD 5120.50 USD
36.00 VEA 36.00 VEA
294.00 VHT 294.00 VHT
>=0
# ** 5. Multicolumn balance report csv output with no commodity columns. # ** 7. Multicolumn balance report csv output with no commodity columns.
$ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O csv $ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O csv
>
"account","2012","2013","2014","total" "account","2012","2013","2014","total"
"Assets:US:ETrade","10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT","70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT","-11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT","70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT" "Assets:US:ETrade","10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT","70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT","-11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT","70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT"
"total","10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT","70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT","-11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT","70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT" "total","10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT","70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT","-11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT","70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT"
>=0
# ** 8.
$ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O tsv $ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O tsv
>
account 2012 2013 2014 total account 2012 2013 2014 total
Assets:US:ETrade 10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT 70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT -11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT Assets:US:ETrade 10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT 70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT -11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT
total 10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT 70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT -11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT total 10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT 70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT -11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT
>=0
# ** 6. Multicolumn balance report csv output with --layout=bare. # ** 9. Multicolumn balance report csv output with --layout=bare.
$ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O csv --layout=bare $ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O csv --layout=bare
>
"account","commodity","2012","2013","2014","total" "account","commodity","2012","2013","2014","total"
"Assets:US:ETrade","GLD","0","70.00","0","70.00" "Assets:US:ETrade","GLD","0","70.00","0","70.00"
"Assets:US:ETrade","ITOT","10.00","18.00","-11.00","17.00" "Assets:US:ETrade","ITOT","10.00","18.00","-11.00","17.00"
@ -109,10 +95,9 @@ $ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O csv --layout=bare
"total","USD","337.18","-98.12","4881.44","5120.50" "total","USD","337.18","-98.12","4881.44","5120.50"
"total","VEA","12.00","10.00","14.00","36.00" "total","VEA","12.00","10.00","14.00","36.00"
"total","VHT","106.00","18.00","170.00","294.00" "total","VHT","106.00","18.00","170.00","294.00"
>=0
# ** 10.
$ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O tsv --layout=bare $ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O tsv --layout=bare
>
account commodity 2012 2013 2014 total account commodity 2012 2013 2014 total
Assets:US:ETrade GLD 0 70.00 0 70.00 Assets:US:ETrade GLD 0 70.00 0 70.00
Assets:US:ETrade ITOT 10.00 18.00 -11.00 17.00 Assets:US:ETrade ITOT 10.00 18.00 -11.00 17.00
@ -124,11 +109,9 @@ total ITOT 10.00 18.00 -11.00 17.00
total USD 337.18 -98.12 4881.44 5120.50 total USD 337.18 -98.12 4881.44 5120.50
total VEA 12.00 10.00 14.00 36.00 total VEA 12.00 10.00 14.00 36.00
total VHT 106.00 18.00 170.00 294.00 total VHT 106.00 18.00 170.00 294.00
>=0
# ** 7. Multicolumn balance report with --layout=bare. # ** 11. Multicolumn balance report with --layout=bare.
$ hledger -f bcexample.hledger bal -Y assets.*etrade -3 --average --layout=bare --no-total $ hledger -f bcexample.hledger bal -Y assets.*etrade -3 --average --layout=bare --no-total
>
Balance changes in 2012-01-01..2014-12-31: Balance changes in 2012-01-01..2014-12-31:
|| Commodity 2012 2013 2014 Average || Commodity 2012 2013 2014 Average
@ -138,11 +121,9 @@ Balance changes in 2012-01-01..2014-12-31:
Assets:US:ETrade || USD 337.18 -98.12 4881.44 1706.83 Assets:US:ETrade || USD 337.18 -98.12 4881.44 1706.83
Assets:US:ETrade || VEA 12.00 10.00 14.00 12.00 Assets:US:ETrade || VEA 12.00 10.00 14.00 12.00
Assets:US:ETrade || VHT 106.00 18.00 170.00 98.00 Assets:US:ETrade || VHT 106.00 18.00 170.00 98.00
>=0
# ** 8. Multicolumn balance report with --row-total, --average, and --summary-only # ** 12. Multicolumn balance report with --row-total, --average, and --summary-only
$ hledger -f bcexample.hledger bal -Y assets.*etrade -3 --layout=bare --row-total --average --summary-only $ hledger -f bcexample.hledger bal -Y assets.*etrade -3 --layout=bare --row-total --average --summary-only
>
Balance changes in 2012-01-01..2014-12-31: Balance changes in 2012-01-01..2014-12-31:
|| Commodity Total Average || Commodity Total Average
@ -158,11 +139,9 @@ Balance changes in 2012-01-01..2014-12-31:
|| USD 5120.50 1706.83 || USD 5120.50 1706.83
|| VEA 36.00 12.00 || VEA 36.00 12.00
|| VHT 294.00 98.00 || VHT 294.00 98.00
>=0
# ** 9. Multicolumn income statement with --row-total, --average, and --summary-only # ** 13. Multicolumn income statement with --row-total, --average, and --summary-only
$ hledger -f bcexample.hledger is -Y income expenses:food -3 --layout=bare --row-total --average --summary-only $ hledger -f bcexample.hledger is -Y income expenses:food -3 --layout=bare --row-total --average --summary-only
>
Income Statement 2012-01-01..2014-12-31 Income Statement 2012-01-01..2014-12-31
|| Commodity Total Average || Commodity Total Average
@ -190,11 +169,9 @@ Income Statement 2012-01-01..2014-12-31
Net: || IRAUSD 52000.00 17333.33 Net: || IRAUSD 52000.00 17333.33
|| USD 345982.46 115327.49 || USD 345982.46 115327.49
|| VACHR 337.26 112.42 || VACHR 337.26 112.42
>=0
# ** 10. Multicolumn budget report csv output with --layout=bare. # ** 14. Multicolumn budget report csv output with --layout=bare.
$ hledger -f bcexample.hledger bal -Y assets.*etrade -3 -O csv --layout=bare --budget $ hledger -f bcexample.hledger bal -Y assets.*etrade -3 -O csv --layout=bare --budget
>
"Account","Commodity","2012","budget","2013","budget","2014","budget" "Account","Commodity","2012","budget","2013","budget","2014","budget"
"<unbudgeted>","GLD","0","0","70.00","0","0","0" "<unbudgeted>","GLD","0","0","70.00","0","0","0"
"<unbudgeted>","ITOT","10.00","0","18.00","0","-11.00","0" "<unbudgeted>","ITOT","10.00","0","18.00","0","-11.00","0"
@ -206,9 +183,8 @@ $ hledger -f bcexample.hledger bal -Y assets.*etrade -3 -O csv --layout=bare --b
"Total:","USD","337.18","0","-98.12","0","4881.44","0" "Total:","USD","337.18","0","-98.12","0","4881.44","0"
"Total:","VEA","12.00","0","10.00","0","14.00","0" "Total:","VEA","12.00","0","10.00","0","14.00","0"
"Total:","VHT","106.00","0","18.00","0","170.00","0" "Total:","VHT","106.00","0","18.00","0","170.00","0"
>=0
# ** 11. Multicolumn balance report with --layout=bare and null commodity # ** 15. Multicolumn balance report with --layout=bare and null commodity
< <
2018/1/1 2018/1/1
(a) 1 (a) 1
@ -230,9 +206,8 @@ Balance changes in 2018:
|| EUR 1 || EUR 1
# ** 12. Multicolumn balance report with --layout=bare --transpose. # ** 16. Multicolumn balance report with --layout=bare --transpose.
$ hledger -f bcexample.hledger bal -Y assets.*etrade -1 --average --layout=bare --transpose $ hledger -f bcexample.hledger bal -Y assets.*etrade -1 --average --layout=bare --transpose
>
Balance changes in 2012-01-01..2014-12-31: Balance changes in 2012-01-01..2014-12-31:
|| Assets Assets Assets Assets Assets | || Assets Assets Assets Assets Assets |
@ -242,9 +217,8 @@ Balance changes in 2012-01-01..2014-12-31:
2013 || 70.00 18.00 -98.12 10.00 18.00 | 70.00 18.00 -98.12 10.00 18.00 2013 || 70.00 18.00 -98.12 10.00 18.00 | 70.00 18.00 -98.12 10.00 18.00
2014 || 0 -11.00 4881.44 14.00 170.00 | 0 -11.00 4881.44 14.00 170.00 2014 || 0 -11.00 4881.44 14.00 170.00 | 0 -11.00 4881.44 14.00 170.00
Average || 23.33 5.67 1706.83 12.00 98.00 | 23.33 5.67 1706.83 12.00 98.00 Average || 23.33 5.67 1706.83 12.00 98.00 | 23.33 5.67 1706.83 12.00 98.00
>=0
# ** 13. Multicolumn budget report with --layout=bare --transpose. # ** 17. Multicolumn budget report with --layout=bare --transpose.
< <
~ daily from 2016/1/1 ~ daily from 2016/1/1
expenses:food $10 expenses:food $10
@ -276,7 +250,6 @@ Balance changes in 2012-01-01..2014-12-31:
assets:cash assets:cash
$ hledger -f- bal --budget --layout=bare --transpose -DTN $ hledger -f- bal --budget --layout=bare --transpose -DTN
>
Budget performance in 2016-12-01..2016-12-03: Budget performance in 2016-12-01..2016-12-03:
|| assets:cash expenses expenses:food expenses:leisure || assets:cash expenses expenses:food expenses:leisure
@ -286,11 +259,9 @@ Budget performance in 2016-12-01..2016-12-03:
2016-12-02 || -14 [ 56% of -25] 14 [ 56% of 25] 9 [ 90% of 10] 5 [33% of 15] 2016-12-02 || -14 [ 56% of -25] 14 [ 56% of 25] 9 [ 90% of 10] 5 [33% of 15]
2016-12-03 || -51 [204% of -25] 51 [204% of 25] 11 [110% of 10] 0 [ 15] 2016-12-03 || -51 [204% of -25] 51 [204% of 25] 11 [110% of 10] 0 [ 15]
Total || -75 [100% of -75] 75 [100% of 75] 30 [100% of 30] 5 [11% of 45] Total || -75 [100% of -75] 75 [100% of 75] 30 [100% of 30] 5 [11% of 45]
>=0
# ** 14. Compound balance report output with --layout=bare. # ** 18. Compound balance report output with --layout=bare.
$ hledger -f bcexample.hledger bs -3 --layout=bare $ hledger -f bcexample.hledger bs -3 --layout=bare
>
Balance Sheet 2014-10-11 Balance Sheet 2014-10-11
|| Commodity 2014-10-11 || Commodity 2014-10-11
@ -331,11 +302,9 @@ Balance Sheet 2014-10-11
|| VBMPX 309.950000000000 || VBMPX 309.950000000000
|| VEA 36.00 || VEA 36.00
|| VHT 294.00 || VHT 294.00
>=0
# ** 15. Multicolumn balance report csv output with --layout=tidy # ** 19. Multicolumn balance report csv output with --layout=tidy
$ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O csv --layout=tidy $ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O csv --layout=tidy
>
"account","period","start_date","end_date","commodity","value" "account","period","start_date","end_date","commodity","value"
"Assets:US:ETrade","2012","2012-01-01","2012-12-31","GLD","0" "Assets:US:ETrade","2012","2012-01-01","2012-12-31","GLD","0"
"Assets:US:ETrade","2012","2012-01-01","2012-12-31","ITOT","10.00" "Assets:US:ETrade","2012","2012-01-01","2012-12-31","ITOT","10.00"
@ -352,10 +321,9 @@ $ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O csv --layout=tidy
"Assets:US:ETrade","2014","2014-01-01","2014-12-31","USD","4881.44" "Assets:US:ETrade","2014","2014-01-01","2014-12-31","USD","4881.44"
"Assets:US:ETrade","2014","2014-01-01","2014-12-31","VEA","14.00" "Assets:US:ETrade","2014","2014-01-01","2014-12-31","VEA","14.00"
"Assets:US:ETrade","2014","2014-01-01","2014-12-31","VHT","170.00" "Assets:US:ETrade","2014","2014-01-01","2014-12-31","VHT","170.00"
>=0
# ** 20.
$ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O tsv --layout=tidy $ hledger -f bcexample.hledger bal -T -Y assets.*etrade -3 -O tsv --layout=tidy
>
account period start_date end_date commodity value account period start_date end_date commodity value
Assets:US:ETrade 2012 2012-01-01 2012-12-31 GLD 0 Assets:US:ETrade 2012 2012-01-01 2012-12-31 GLD 0
Assets:US:ETrade 2012 2012-01-01 2012-12-31 ITOT 10.00 Assets:US:ETrade 2012 2012-01-01 2012-12-31 ITOT 10.00
@ -372,43 +340,38 @@ Assets:US:ETrade 2014 2014-01-01 2014-12-31 ITOT -11.00
Assets:US:ETrade 2014 2014-01-01 2014-12-31 USD 4881.44 Assets:US:ETrade 2014 2014-01-01 2014-12-31 USD 4881.44
Assets:US:ETrade 2014 2014-01-01 2014-12-31 VEA 14.00 Assets:US:ETrade 2014 2014-01-01 2014-12-31 VEA 14.00
Assets:US:ETrade 2014 2014-01-01 2014-12-31 VHT 170.00 Assets:US:ETrade 2014 2014-01-01 2014-12-31 VHT 170.00
>=0
# ** 16. Single column balance report csv output with --layout=tidy # ** 21. Single column balance report csv output with --layout=tidy
$ hledger -f bcexample.hledger bal -T assets.*etrade -3 -O csv --layout=tidy $ hledger -f bcexample.hledger bal -T assets.*etrade -3 -O csv --layout=tidy
>
"account","period","start_date","end_date","commodity","value" "account","period","start_date","end_date","commodity","value"
"Assets:US:ETrade","2012-01-01..2014-10-11","2012-01-01","2014-10-11","GLD","70.00" "Assets:US:ETrade","2012-01-01..2014-10-11","2012-01-01","2014-10-11","GLD","70.00"
"Assets:US:ETrade","2012-01-01..2014-10-11","2012-01-01","2014-10-11","ITOT","17.00" "Assets:US:ETrade","2012-01-01..2014-10-11","2012-01-01","2014-10-11","ITOT","17.00"
"Assets:US:ETrade","2012-01-01..2014-10-11","2012-01-01","2014-10-11","USD","5120.50" "Assets:US:ETrade","2012-01-01..2014-10-11","2012-01-01","2014-10-11","USD","5120.50"
"Assets:US:ETrade","2012-01-01..2014-10-11","2012-01-01","2014-10-11","VEA","36.00" "Assets:US:ETrade","2012-01-01..2014-10-11","2012-01-01","2014-10-11","VEA","36.00"
"Assets:US:ETrade","2012-01-01..2014-10-11","2012-01-01","2014-10-11","VHT","294.00" "Assets:US:ETrade","2012-01-01..2014-10-11","2012-01-01","2014-10-11","VHT","294.00"
>=0
# ** 22.
$ hledger -f bcexample.hledger bal -T assets.*etrade -3 -O tsv --layout=tidy $ hledger -f bcexample.hledger bal -T assets.*etrade -3 -O tsv --layout=tidy
>
account period start_date end_date commodity value account period start_date end_date commodity value
Assets:US:ETrade 2012-01-01..2014-10-11 2012-01-01 2014-10-11 GLD 70.00 Assets:US:ETrade 2012-01-01..2014-10-11 2012-01-01 2014-10-11 GLD 70.00
Assets:US:ETrade 2012-01-01..2014-10-11 2012-01-01 2014-10-11 ITOT 17.00 Assets:US:ETrade 2012-01-01..2014-10-11 2012-01-01 2014-10-11 ITOT 17.00
Assets:US:ETrade 2012-01-01..2014-10-11 2012-01-01 2014-10-11 USD 5120.50 Assets:US:ETrade 2012-01-01..2014-10-11 2012-01-01 2014-10-11 USD 5120.50
Assets:US:ETrade 2012-01-01..2014-10-11 2012-01-01 2014-10-11 VEA 36.00 Assets:US:ETrade 2012-01-01..2014-10-11 2012-01-01 2014-10-11 VEA 36.00
Assets:US:ETrade 2012-01-01..2014-10-11 2012-01-01 2014-10-11 VHT 294.00 Assets:US:ETrade 2012-01-01..2014-10-11 2012-01-01 2014-10-11 VHT 294.00
>=0
# ** 23. Should omit commodity from totals row when the sum is zero with --layout=bare. (#1789)
< <
2021-01-01 Test 2021-01-01 Test
Assets:Bank INR 1.00 Assets:Bank INR 1.00
Equity:Opening INR -1.00 Equity:Opening INR -1.00
# ** 17. Should omit commodity from totals row when the sum is zero with --layout=bare. (#1789)
$ hledger -f - bal --layout=bare $ hledger -f - bal --layout=bare
1.00 INR Assets:Bank 1.00 INR Assets:Bank
-1.00 INR Equity:Opening -1.00 INR Equity:Opening
----- -----
0 0
>=0
# ** 18. The same with -M. (#1789) # ** 24. The same with -M. (#1789)
$ hledger -f - bal --layout=bare -M $ hledger -f - bal --layout=bare -M
Balance changes in 2021-01: Balance changes in 2021-01:
@ -418,4 +381,3 @@ Balance changes in 2021-01:
Equity:Opening || INR -1.00 Equity:Opening || INR -1.00
----------------++------------------ ----------------++------------------
|| 0 || 0
>=0