balcmds: avoid short month names in multi-year monthly reports

This commit is contained in:
Simon Michael 2020-07-09 12:56:46 -07:00
parent f4991d05b4
commit f518da747c
5 changed files with 33 additions and 31 deletions

View File

@ -317,8 +317,10 @@ budgetReportAsTable
reportPeriodName :: BalanceType -> [DateSpan] -> DateSpan -> String
reportPeriodName balancetype spans =
case balancetype of
PeriodChange -> showDateSpanMonthAbbrev
_ -> maybe "" (showDate . prevday) . spanEnd
PeriodChange -> if multiyear then showDateSpan else showDateSpanMonthAbbrev
where
multiyear = (>1) $ length $ nubSort $ map spanStartYear spans
_ -> maybe "" (showDate . prevday) . spanEnd
-- tests

View File

@ -340,7 +340,7 @@ P 2018/01/26 SHARE €10
$ hledger -f - bal -M --budget --cumulative --forecast -V
Budget performance in 2018-05-01..2018-06-30, valued at period ends:
|| May Jun
|| 2018-05-31 2018-06-30
================++==========================================
<unbudgeted> || €-10 €-10
assets || €10 €10 [ 0]

View File

@ -2,11 +2,11 @@ hledger -f balance-multicol.journal balance --pretty-tables -M
>>>
Balance changes in 2012-12-01..2013-03-31:
Dec Jan Feb Mar
═════════════════╬════════════════════
assets ║ 0 0 1 0
assets:cash ║ 0 0 1 0
assets:checking ║ 10 0 0 1
─────────────────╫────────────────────
║ 10 0 2 1
2012-12 2013-01 2013-02 2013-03
═════════════════╬════════════════════════════════════
assets ║ 0 0 1 0
assets:cash ║ 0 0 1 0
assets:checking ║ 10 0 0 1
─────────────────╫────────────────────────────────────
10 0 2 1
>>>=0

View File

@ -4,10 +4,10 @@ Balance changes in 2012-12-01..2013-03-31:
|| assets assets:cash assets:checking |
=========++======================================+====
Dec || 0 0 10 | 10
Jan || 0 0 0 | 0
Feb || 1 1 0 | 2
Mar || 0 0 1 | 1
2012-12 || 0 0 10 | 10
2013-01 || 0 0 0 | 0
2013-02 || 1 1 0 | 2
2013-03 || 0 0 1 | 1
Average || 0 0 3 | 3
>>>=0

View File

@ -18,16 +18,16 @@ hledger bal -M -b 2016-11 -e 2017-02 -f - --forecast
>>>
Balance changes in 2016-12-01..2017-01-31:
|| Dec Jan
==================++===============
assets:cash || $-600 $935
expenses:food || 0 $20
expenses:grocery || 0 $30
expenses:housing || $600 0
expenses:leisure || 0 $15
income || 0 $-1000
------------------++---------------
|| 0 0
|| 2016-12 2017-01
==================++==================
assets:cash || $-600 $935
expenses:food || 0 $20
expenses:grocery || 0 $30
expenses:housing || $600 0
expenses:leisure || 0 $15
income || 0 $-1000
------------------++------------------
|| 0 0
>>>2
>>>=0
@ -171,13 +171,13 @@ hledger bal -M -b 2016-10 -e 2017-02 -f - --forecast=20160801-
>>>
Balance changes in 2016-10-01..2017-01-31:
|| Oct Nov Dec Jan
==================++================================
assets:cash || $1000 $1000 $400 $1000
expenses:housing || 0 0 $600 0
income || $-1000 $-1000 $-1000 $-1000
------------------++--------------------------------
|| 0 0 0 0
|| 2016-10 2016-11 2016-12 2017-01
==================++====================================
assets:cash || $1000 $1000 $400 $1000
expenses:housing || 0 0 $600 0
income || $-1000 $-1000 $-1000 $-1000
------------------++------------------------------------
|| 0 0 0 0
>>>2
>>>=0