diff --git a/hledger/Hledger/Cli/Commands/Balance.txt b/hledger/Hledger/Cli/Commands/Balance.txt index f3d8df65a..342b4cf53 100644 --- a/hledger/Hledger/Cli/Commands/Balance.txt +++ b/hledger/Hledger/Cli/Commands/Balance.txt @@ -59,14 +59,16 @@ balance can show.. - rows and columns swapped (--transpose) - another field used as account name (--pivot) - custom-formatted line items (single-period reports only) (--format) -- commodities shown in a separate column, one per row - (--commodity-column) +- commodities displayed on the same line or multiple lines (--layout) This command supports the output destination and output format options, with output formats txt, csv, json, and (multi-period reports only:) html. In txt output in a colour-supporting terminal, negative amounts are shown in red. +The --related/-r flag shows the balance of the other postings in the +transactions of the postings which would normally be shown. + Simple balance report With no arguments, balance shows a list of all accounts and their change @@ -240,15 +242,25 @@ in the terminal. Here are some ways to handle that: - Output as HTML and view with a browser: hledger bal -D -o a.html && open a.html -Commodity column +Commodity layout -With --commodity-column, commodity symbols are displayed in a separate -column, and amounts are displayed as bare numbers. In this mode, each -report row will show amounts for a single commodity, using extra rows -when necessary. It can be useful for a cleaner display of reports with -many commodities: +With --layout, you can control how amounts with more than one commodity +are displayed: - --layout=wide[,WIDTH]: on a single line, possibly +elided to the specified width - --layout=tall: each commodity is +displayed on a separate line - --layout=bare: commodity symbols are +displayed in a separate column, and amounts are displayed as bare +numbers -$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y +$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=wide +Balance changes in 2012-01-01..2014-12-31: + + || 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 +------------------++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + || 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 + +$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=wide,32 Balance changes in 2012-01-01..2014-12-31: || 2012 2013 2014 Total @@ -257,7 +269,24 @@ Balance changes in 2012-01-01..2014-12-31: ------------------++--------------------------------------------------------------------------------------------------------------------------- || 10.00 ITOT, 337.18 USD, 2 more.. 70.00 GLD, 18.00 ITOT, 3 more.. -11.00 ITOT, 3 more.. 70.00 GLD, 17.00 ITOT, 3 more.. -$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --commodity-column +$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=tall +Balance changes in 2012-01-01..2014-12-31: + + || 2012 2013 2014 Total +==================++================================================== + Assets:US:ETrade || 10.00 ITOT 70.00 GLD -11.00 ITOT 70.00 GLD + Assets:US:ETrade || 337.18 USD 18.00 ITOT 4881.44 USD 17.00 ITOT + Assets:US:ETrade || 12.00 VEA -98.12 USD 14.00 VEA 5120.50 USD + Assets:US:ETrade || 106.00 VHT 10.00 VEA 170.00 VHT 36.00 VEA + Assets:US:ETrade || 18.00 VHT 294.00 VHT +------------------++-------------------------------------------------- + || 10.00 ITOT 70.00 GLD -11.00 ITOT 70.00 GLD + || 337.18 USD 18.00 ITOT 4881.44 USD 17.00 ITOT + || 12.00 VEA -98.12 USD 14.00 VEA 5120.50 USD + || 106.00 VHT 10.00 VEA 170.00 VHT 36.00 VEA + || 18.00 VHT 294.00 VHT + +$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=bare Balance changes in 2012-01-01..2014-12-31: || Commodity 2012 2013 2014 Total @@ -274,15 +303,15 @@ Balance changes in 2012-01-01..2014-12-31: || VEA 12.00 10.00 14.00 36.00 || VHT 106.00 18.00 170.00 294.00 -This flag also affects CSV output, which is useful for producing data -that is easier to consume, eg when making charts: +The option --layout=bare also affects CSV output, which is useful for +producing data that is easier to consume, eg when making charts: $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -O csv "account","balance" "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" -$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -O csv --commodity-column +$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -O csv --layout=bare "account","commodity","balance" "Assets:US:ETrade","GLD","70.00" "Assets:US:ETrade","ITOT","17.00"