lib: More consistent period formatting.

This commit is contained in:
Stephen Morgan 2020-03-22 23:51:18 +11:00 committed by Simon Michael
parent 057b79558c
commit 2f71da8838
18 changed files with 250 additions and 250 deletions

View File

@ -167,31 +167,31 @@ spansSpan spans = DateSpan (maybe Nothing spanStart $ headMay spans) (maybe Noth
-- >>> t NoInterval "2008/01/01" "2009/01/01" -- >>> t NoInterval "2008/01/01" "2009/01/01"
-- [DateSpan 2008] -- [DateSpan 2008]
-- >>> t (Quarters 1) "2008/01/01" "2009/01/01" -- >>> t (Quarters 1) "2008/01/01" "2009/01/01"
-- [DateSpan 2008q1,DateSpan 2008q2,DateSpan 2008q3,DateSpan 2008q4] -- [DateSpan 2008Q1,DateSpan 2008Q2,DateSpan 2008Q3,DateSpan 2008Q4]
-- >>> splitSpan (Quarters 1) nulldatespan -- >>> splitSpan (Quarters 1) nulldatespan
-- [DateSpan -] -- [DateSpan ..]
-- >>> t (Days 1) "2008/01/01" "2008/01/01" -- an empty datespan -- >>> t (Days 1) "2008/01/01" "2008/01/01" -- an empty datespan
-- [] -- []
-- >>> t (Quarters 1) "2008/01/01" "2008/01/01" -- >>> t (Quarters 1) "2008/01/01" "2008/01/01"
-- [] -- []
-- >>> t (Months 1) "2008/01/01" "2008/04/01" -- >>> t (Months 1) "2008/01/01" "2008/04/01"
-- [DateSpan 2008/01,DateSpan 2008/02,DateSpan 2008/03] -- [DateSpan 2008-01,DateSpan 2008-02,DateSpan 2008-03]
-- >>> t (Months 2) "2008/01/01" "2008/04/01" -- >>> t (Months 2) "2008/01/01" "2008/04/01"
-- [DateSpan 2008-01-01-2008-02-29,DateSpan 2008-03-01-2008-04-30] -- [DateSpan 2008-01-01..2008-02-29,DateSpan 2008-03-01..2008-04-30]
-- >>> t (Weeks 1) "2008/01/01" "2008/01/15" -- >>> t (Weeks 1) "2008/01/01" "2008/01/15"
-- [DateSpan 2007-12-31w01,DateSpan 2008-01-07w02,DateSpan 2008-01-14w03] -- [DateSpan 2007-12-31W01,DateSpan 2008-01-07W02,DateSpan 2008-01-14W03]
-- >>> t (Weeks 2) "2008/01/01" "2008/01/15" -- >>> t (Weeks 2) "2008/01/01" "2008/01/15"
-- [DateSpan 2007-12-31-2008-01-13,DateSpan 2008-01-14-2008-01-27] -- [DateSpan 2007-12-31..2008-01-13,DateSpan 2008-01-14..2008-01-27]
-- >>> t (DayOfMonth 2) "2008/01/01" "2008/04/01" -- >>> t (DayOfMonth 2) "2008/01/01" "2008/04/01"
-- [DateSpan 2007-12-02-2008-01-01,DateSpan 2008-01-02-2008-02-01,DateSpan 2008-02-02-2008-03-01,DateSpan 2008-03-02-2008-04-01] -- [DateSpan 2007-12-02..2008-01-01,DateSpan 2008-01-02..2008-02-01,DateSpan 2008-02-02..2008-03-01,DateSpan 2008-03-02..2008-04-01]
-- >>> t (WeekdayOfMonth 2 4) "2011/01/01" "2011/02/15" -- >>> t (WeekdayOfMonth 2 4) "2011/01/01" "2011/02/15"
-- [DateSpan 2010-12-09-2011-01-12,DateSpan 2011-01-13-2011-02-09,DateSpan 2011-02-10-2011-03-09] -- [DateSpan 2010-12-09..2011-01-12,DateSpan 2011-01-13..2011-02-09,DateSpan 2011-02-10..2011-03-09]
-- >>> t (DayOfWeek 2) "2011/01/01" "2011/01/15" -- >>> t (DayOfWeek 2) "2011/01/01" "2011/01/15"
-- [DateSpan 2010-12-28-2011-01-03,DateSpan 2011-01-04-2011-01-10,DateSpan 2011-01-11-2011-01-17] -- [DateSpan 2010-12-28..2011-01-03,DateSpan 2011-01-04..2011-01-10,DateSpan 2011-01-11..2011-01-17]
-- >>> t (DayOfYear 11 29) "2011/10/01" "2011/10/15" -- >>> t (DayOfYear 11 29) "2011/10/01" "2011/10/15"
-- [DateSpan 2010-11-29-2011-11-28] -- [DateSpan 2010-11-29..2011-11-28]
-- >>> t (DayOfYear 11 29) "2011/12/01" "2012/12/15" -- >>> t (DayOfYear 11 29) "2011/12/01" "2012/12/15"
-- [DateSpan 2011-11-29-2012-11-28,DateSpan 2012-11-29-2013-11-28] -- [DateSpan 2011-11-29..2012-11-28,DateSpan 2012-11-29..2013-11-28]
-- --
splitSpan :: Interval -> DateSpan -> [DateSpan] splitSpan :: Interval -> DateSpan -> [DateSpan]
splitSpan _ (DateSpan Nothing Nothing) = [DateSpan Nothing Nothing] splitSpan _ (DateSpan Nothing Nothing) = [DateSpan Nothing Nothing]
@ -259,7 +259,7 @@ spansIntersect (d:ds) = d `spanIntersect` (spansIntersect ds)
-- --
-- For non-intersecting spans, gives an empty span beginning on the second's start date: -- For non-intersecting spans, gives an empty span beginning on the second's start date:
-- >>> mkdatespan "2018-01-01" "2018-01-03" `spanIntersect` mkdatespan "2018-01-03" "2018-01-05" -- >>> mkdatespan "2018-01-01" "2018-01-03" `spanIntersect` mkdatespan "2018-01-03" "2018-01-05"
-- DateSpan 2018-01-03-2018-01-02 -- DateSpan 2018-01-03..2018-01-02
spanIntersect (DateSpan b1 e1) (DateSpan b2 e2) = DateSpan b e spanIntersect (DateSpan b1 e1) (DateSpan b2 e2) = DateSpan b e
where where
b = latest b1 b2 b = latest b1 b2
@ -914,47 +914,47 @@ lastthisnextthing = do
-- --
-- >>> let p = parsePeriodExpr (parsedate "2008/11/26") -- >>> let p = parsePeriodExpr (parsedate "2008/11/26")
-- >>> p "from Aug to Oct" -- >>> p "from Aug to Oct"
-- Right (NoInterval,DateSpan 2008-08-01-2008-09-30) -- Right (NoInterval,DateSpan 2008-08-01..2008-09-30)
-- >>> p "aug to oct" -- >>> p "aug to oct"
-- Right (NoInterval,DateSpan 2008-08-01-2008-09-30) -- Right (NoInterval,DateSpan 2008-08-01..2008-09-30)
-- >>> p "every 3 days in Aug" -- >>> p "every 3 days in Aug"
-- Right (Days 3,DateSpan 2008/08) -- Right (Days 3,DateSpan 2008-08)
-- >>> p "daily from aug" -- >>> p "daily from aug"
-- Right (Days 1,DateSpan 2008-08-01-) -- Right (Days 1,DateSpan 2008-08-01..)
-- >>> p "every week to 2009" -- >>> p "every week to 2009"
-- Right (Weeks 1,DateSpan -2008-12-31) -- Right (Weeks 1,DateSpan ..2008-12-31)
-- >>> p "every 2nd day of month" -- >>> p "every 2nd day of month"
-- Right (DayOfMonth 2,DateSpan -) -- Right (DayOfMonth 2,DateSpan ..)
-- >>> p "every 2nd day" -- >>> p "every 2nd day"
-- Right (DayOfMonth 2,DateSpan -) -- Right (DayOfMonth 2,DateSpan ..)
-- >>> p "every 2nd day 2009-" -- >>> p "every 2nd day 2009-"
-- Right (DayOfMonth 2,DateSpan 2009-01-01-) -- Right (DayOfMonth 2,DateSpan 2009-01-01..)
-- >>> p "every 29th Nov" -- >>> p "every 29th Nov"
-- Right (DayOfYear 11 29,DateSpan -) -- Right (DayOfYear 11 29,DateSpan ..)
-- >>> p "every 29th nov -2009" -- >>> p "every 29th nov -2009"
-- Right (DayOfYear 11 29,DateSpan -2008-12-31) -- Right (DayOfYear 11 29,DateSpan ..2008-12-31)
-- >>> p "every nov 29th" -- >>> p "every nov 29th"
-- Right (DayOfYear 11 29,DateSpan -) -- Right (DayOfYear 11 29,DateSpan ..)
-- >>> p "every Nov 29th 2009-" -- >>> p "every Nov 29th 2009-"
-- Right (DayOfYear 11 29,DateSpan 2009-01-01-) -- Right (DayOfYear 11 29,DateSpan 2009-01-01..)
-- >>> p "every 11/29 from 2009" -- >>> p "every 11/29 from 2009"
-- Right (DayOfYear 11 29,DateSpan 2009-01-01-) -- Right (DayOfYear 11 29,DateSpan 2009-01-01..)
-- >>> p "every 2nd Thursday of month to 2009" -- >>> p "every 2nd Thursday of month to 2009"
-- Right (WeekdayOfMonth 2 4,DateSpan -2008-12-31) -- Right (WeekdayOfMonth 2 4,DateSpan ..2008-12-31)
-- >>> p "every 1st monday of month to 2009" -- >>> p "every 1st monday of month to 2009"
-- Right (WeekdayOfMonth 1 1,DateSpan -2008-12-31) -- Right (WeekdayOfMonth 1 1,DateSpan ..2008-12-31)
-- >>> p "every tue" -- >>> p "every tue"
-- Right (DayOfWeek 2,DateSpan -) -- Right (DayOfWeek 2,DateSpan ..)
-- >>> p "every 2nd day of week" -- >>> p "every 2nd day of week"
-- Right (DayOfWeek 2,DateSpan -) -- Right (DayOfWeek 2,DateSpan ..)
-- >>> p "every 2nd day of month" -- >>> p "every 2nd day of month"
-- Right (DayOfMonth 2,DateSpan -) -- Right (DayOfMonth 2,DateSpan ..)
-- >>> p "every 2nd day" -- >>> p "every 2nd day"
-- Right (DayOfMonth 2,DateSpan -) -- Right (DayOfMonth 2,DateSpan ..)
-- >>> p "every 2nd day 2009-" -- >>> p "every 2nd day 2009-"
-- Right (DayOfMonth 2,DateSpan 2009-01-01-) -- Right (DayOfMonth 2,DateSpan 2009-01-01..)
-- >>> p "every 2nd day of month 2009-" -- >>> p "every 2nd day of month 2009-"
-- Right (DayOfMonth 2,DateSpan 2009-01-01-) -- Right (DayOfMonth 2,DateSpan 2009-01-01..)
periodexprp :: Day -> TextParser m (Interval, DateSpan) periodexprp :: Day -> TextParser m (Interval, DateSpan)
periodexprp rdate = do periodexprp rdate = do
skipMany spacenonewline skipMany spacenonewline
@ -1066,7 +1066,7 @@ periodexprdatespanp rdate = choice $ map try [
-- | -- |
-- -- >>> parsewith (doubledatespan (parsedate "2018/01/01") <* eof) "20180101-201804" -- -- >>> parsewith (doubledatespan (parsedate "2018/01/01") <* eof) "20180101-201804"
-- Right DateSpan 2018-01-01-2018-04-01 -- Right DateSpan 2018-01-01..2018-04-01
doubledatespanp :: Day -> TextParser m DateSpan doubledatespanp :: Day -> TextParser m DateSpan
doubledatespanp rdate = do doubledatespanp rdate = do
optional (string' "from" >> skipMany spacenonewline) optional (string' "from" >> skipMany spacenonewline)

View File

@ -154,17 +154,17 @@ isStandardPeriod = isStandardPeriod' . simplifyPeriod
-- | Render a period as a compact display string suitable for user output. -- | Render a period as a compact display string suitable for user output.
-- --
-- >>> showPeriod (WeekPeriod (fromGregorian 2016 7 25)) -- >>> showPeriod (WeekPeriod (fromGregorian 2016 7 25))
-- "2016-07-25w30" -- "2016-07-25W30"
showPeriod (DayPeriod b) = formatTime defaultTimeLocale "%F" b -- DATE showPeriod (DayPeriod b) = formatTime defaultTimeLocale "%F" b -- DATE
showPeriod (WeekPeriod b) = formatTime defaultTimeLocale "%Fw%V" b -- STARTDATEwYEARWEEK showPeriod (WeekPeriod b) = formatTime defaultTimeLocale "%FW%V" b -- STARTDATEWYEARWEEK
showPeriod (MonthPeriod y m) = printf "%04d/%02d" y m -- YYYY/MM showPeriod (MonthPeriod y m) = printf "%04d-%02d" y m -- YYYY-MM
showPeriod (QuarterPeriod y q) = printf "%04dq%d" y q -- YYYYqN showPeriod (QuarterPeriod y q) = printf "%04dQ%d" y q -- YYYYQN
showPeriod (YearPeriod y) = printf "%04d" y -- YYYY showPeriod (YearPeriod y) = printf "%04d" y -- YYYY
showPeriod (PeriodBetween b e) = formatTime defaultTimeLocale "%F" b showPeriod (PeriodBetween b e) = formatTime defaultTimeLocale "%F" b
++ formatTime defaultTimeLocale "-%F" (addDays (-1) e) -- STARTDATE-INCLUSIVEENDDATE ++ formatTime defaultTimeLocale "..%F" (addDays (-1) e) -- STARTDATE..INCLUSIVEENDDATE
showPeriod (PeriodFrom b) = formatTime defaultTimeLocale "%F-" b -- STARTDATE- showPeriod (PeriodFrom b) = formatTime defaultTimeLocale "%F.." b -- STARTDATE..
showPeriod (PeriodTo e) = formatTime defaultTimeLocale "-%F" (addDays (-1) e) -- -INCLUSIVEENDDATE showPeriod (PeriodTo e) = formatTime defaultTimeLocale "..%F" (addDays (-1) e) -- ..INCLUSIVEENDDATE
showPeriod PeriodAll = "-" showPeriod PeriodAll = ".."
-- | Like showPeriod, but if it's a month period show just -- | Like showPeriod, but if it's a month period show just
-- the 3 letter month name abbreviation for the current locale. -- the 3 letter month name abbreviation for the current locale.

View File

@ -2,7 +2,7 @@
# 1. multiple flags ending with --flat, equivalent to --flat # 1. multiple flags ending with --flat, equivalent to --flat
hledger -f balance-multicol.journal bal -MEH --no-total date:2013/1 --tree --flat hledger -f balance-multicol.journal bal -MEH --no-total date:2013/1 --tree --flat
>>> >>>
Ending balances (historical) in 2013/01: Ending balances (historical) in 2013-01:
|| 2013-01-31 || 2013-01-31
=================++============ =================++============
@ -12,7 +12,7 @@ Ending balances (historical) in 2013/01:
# 2. multiple flags ending with --tree, equivalent to --tree # 2. multiple flags ending with --tree, equivalent to --tree
hledger -f balance-multicol.journal bal -MEH --no-total date:2013/1 --flat --tree hledger -f balance-multicol.journal bal -MEH --no-total date:2013/1 --flat --tree
>>> >>>
Ending balances (historical) in 2013/01: Ending balances (historical) in 2013-01:
|| 2013-01-31 || 2013-01-31
============++============ ============++============

View File

@ -36,7 +36,7 @@
assets:cash assets:cash
$ hledger -f- bal --budget -DTN $ hledger -f- bal --budget -DTN
Budget performance in 2016-12-01-2016-12-03: Budget performance in 2016-12-01..2016-12-03:
|| 2016-12-01 2016-12-02 2016-12-03 Total || 2016-12-01 2016-12-02 2016-12-03 Total
==================++======================================================================================== ==================++========================================================================================
@ -82,7 +82,7 @@ account expenses:leisure
assets:cash assets:cash
$ hledger -f- bal --budget -DTN $ hledger -f- bal --budget -DTN
Budget performance in 2016-12-01-2016-12-03: Budget performance in 2016-12-01..2016-12-03:
|| 2016-12-01 2016-12-02 2016-12-03 Total || 2016-12-01 2016-12-02 2016-12-03 Total
==================++======================================================================================== ==================++========================================================================================
@ -94,7 +94,7 @@ Budget performance in 2016-12-01-2016-12-03:
# # 2. -E # # 2. -E
# $ hledger bal -D -b 2016-12-01 -e 2016-12-04 -f - --budget -E # $ hledger bal -D -b 2016-12-01 -e 2016-12-04 -f - --budget -E
# Budget performance in 2016-12-01-2016-12-03: # Budget performance in 2016-12-01..2016-12-03:
# || 2016-12-01 2016-12-02 2016-12-03 # || 2016-12-01 2016-12-02 2016-12-03
# ==============================++============================================================================== # ==============================++==============================================================================
@ -142,7 +142,7 @@ Budget performance in 2016-12-01-2016-12-03:
# assets:cash # assets:cash
# $ hledger bal -D -b 2016-12-01 -e 2016-12-04 -f - --budget # $ hledger bal -D -b 2016-12-01 -e 2016-12-04 -f - --budget
# Budget performance in 2016-12-01-2016-12-03: # Budget performance in 2016-12-01..2016-12-03:
# || 2016-12-01 2016-12-02 2016-12-03 # || 2016-12-01 2016-12-02 2016-12-03
# ==================++===================================================================================== # ==================++=====================================================================================
@ -156,7 +156,7 @@ Budget performance in 2016-12-01-2016-12-03:
#** Sort by actual amount, flat mode. #** Sort by actual amount, flat mode.
$ hledger -f- bal --budget -DTNS $ hledger -f- bal --budget -DTNS
Budget performance in 2016-12-01-2016-12-03: Budget performance in 2016-12-01..2016-12-03:
|| 2016-12-01 2016-12-02 2016-12-03 Total || 2016-12-01 2016-12-02 2016-12-03 Total
==================++======================================================================================== ==================++========================================================================================
@ -169,7 +169,7 @@ Budget performance in 2016-12-01-2016-12-03:
#** Sort by actual amount, tree mode. #** Sort by actual amount, tree mode.
$ hledger -f- bal --budget -DTNS --tree $ hledger -f- bal --budget -DTNS --tree
Budget performance in 2016-12-01-2016-12-03: Budget performance in 2016-12-01..2016-12-03:
|| 2016-12-01 2016-12-02 2016-12-03 Total || 2016-12-01 2016-12-02 2016-12-03 Total
===========++======================================================================================== ===========++========================================================================================

View File

@ -32,7 +32,7 @@
# 1. Test --budget switch # 1. Test --budget switch
$ hledger -f- bal -D -b 2016-12-01 -e 2016-12-04 --budget $ hledger -f- bal -D -b 2016-12-01 -e 2016-12-04 --budget
Budget performance in 2016-12-01-2016-12-03: Budget performance in 2016-12-01..2016-12-03:
|| 2016-12-01 2016-12-02 2016-12-03 || 2016-12-01 2016-12-02 2016-12-03
==================++================================================================== ==================++==================================================================
@ -46,7 +46,7 @@ Budget performance in 2016-12-01-2016-12-03:
# 2. -E # 2. -E
$ hledger -f- bal -D -b 2016-12-01 -e 2016-12-04 --budget -E $ hledger -f- bal -D -b 2016-12-01 -e 2016-12-04 --budget -E
Budget performance in 2016-12-01-2016-12-03: Budget performance in 2016-12-01..2016-12-03:
|| 2016-12-01 2016-12-02 2016-12-03 || 2016-12-01 2016-12-02 2016-12-03
==================++================================================================== ==================++==================================================================
@ -96,7 +96,7 @@ Budget performance in 2016-12-01-2016-12-03:
assets:cash assets:cash
$ hledger -f- bal -D -b 2016-12-01 -e 2016-12-04 --budget $ hledger -f- bal -D -b 2016-12-01 -e 2016-12-04 --budget
Budget performance in 2016-12-01-2016-12-03: Budget performance in 2016-12-01..2016-12-03:
|| 2016-12-01 2016-12-02 2016-12-03 || 2016-12-01 2016-12-02 2016-12-03
==================++====================================================================================== ==================++======================================================================================
@ -131,21 +131,21 @@ Budget performance in 2016-12-01-2016-12-03:
(c) 1 (c) 1
$ hledger -f- bal --budget $ hledger -f- bal --budget
Budget performance in 2018-01-01-2018-01-03: Budget performance in 2018-01-01..2018-01-03:
|| 2018-01-01-2018-01-03 || 2018-01-01..2018-01-03
===++======================= ===++========================
a || 2 [ 7% of 30] a || 2 [ 7% of 30]
b || 2 [ 2% of 100] b || 2 [ 2% of 100]
c || 2 [ 0% of 1000] c || 2 [ 0% of 1000]
---++----------------------- ---++------------------------
|| 6 [ 1% of 1130] || 6 [ 1% of 1130]
# 5. Multiple periodic transactions with different intervals are combined. # 5. Multiple periodic transactions with different intervals are combined.
# Budget goals with lower frequency than the report are posted in the # Budget goals with lower frequency than the report are posted in the
# appropriate intermittent periods. # appropriate intermittent periods.
$ hledger -f- bal --budget -D $ hledger -f- bal --budget -D
Budget performance in 2018-01-01-2018-01-03: Budget performance in 2018-01-01..2018-01-03:
|| 2018-01-01 2018-01-02 2018-01-03 || 2018-01-01 2018-01-02 2018-01-03
===++========================================================= ===++=========================================================
@ -157,9 +157,9 @@ Budget performance in 2018-01-01-2018-01-03:
# 6. Budget goals with higher frequency than the report get added up appropriately. # 6. Budget goals with higher frequency than the report get added up appropriately.
$ hledger -f- bal --budget -W $ hledger -f- bal --budget -W
Budget performance in 2018-01-01w01: Budget performance in 2018-01-01W01:
|| 2018-01-01w01 || 2018-01-01W01
===++=================== ===++===================
a || 2 [ 7% of 30] a || 2 [ 7% of 30]
b || 2 [ 2% of 100] b || 2 [ 2% of 100]
@ -189,7 +189,7 @@ Budget performance in 2018-01-01w01:
(b) 1 (b) 1
$ hledger -f- bal --budget -D $ hledger -f- bal --budget -D
Budget performance in 2018-01-01-2018-01-04: Budget performance in 2018-01-01..2018-01-04:
|| 2018-01-01 2018-01-02 2018-01-03 2018-01-04 || 2018-01-01 2018-01-02 2018-01-03 2018-01-04
==============++================================================================ ==============++================================================================
@ -219,7 +219,7 @@ Budget performance in 2018-01-01-2018-01-04:
(a) 1 (a) 1
$ hledger -f- bal --budget -D $ hledger -f- bal --budget -D
Budget performance in 2018-01-01-2018-01-04: Budget performance in 2018-01-01..2018-01-04:
|| 2018-01-01 2018-01-02 2018-01-03 2018-01-04 || 2018-01-01 2018-01-02 2018-01-03 2018-01-04
===++==================================================================== ===++====================================================================
@ -229,7 +229,7 @@ Budget performance in 2018-01-01-2018-01-04:
# 9. A "from A to B" budget should not be included in a report beginning on B. # 9. A "from A to B" budget should not be included in a report beginning on B.
$ hledger -f- bal --budget -D -b 2018/1/3 $ hledger -f- bal --budget -D -b 2018/1/3
Budget performance in 2018-01-03-2018-01-04: Budget performance in 2018-01-03..2018-01-04:
|| 2018-01-03 2018-01-04 || 2018-01-03 2018-01-04
===++================================== ===++==================================
@ -251,7 +251,7 @@ Budget performance in 2018-01-03-2018-01-04:
# even if there are no actual transactions in the period, # even if there are no actual transactions in the period,
# or if the actual amount is zero. # or if the actual amount is zero.
$ hledger -f- bal --budget -D date:2018/1/1-2018/1/3 $ hledger -f- bal --budget -D date:2018/1/1-2018/1/3
Budget performance in 2018-01-01-2018-01-02: Budget performance in 2018-01-01..2018-01-02:
|| 2018-01-01 2018-01-02 || 2018-01-01 2018-01-02
===++================================ ===++================================
@ -261,7 +261,7 @@ Budget performance in 2018-01-01-2018-01-02:
# 11. With -E, zeroes are shown # 11. With -E, zeroes are shown
$ hledger -f- bal --budget -D date:2018/1/1-2018/1/3 -E $ hledger -f- bal --budget -D date:2018/1/1-2018/1/3 -E
Budget performance in 2018-01-01-2018-01-02: Budget performance in 2018-01-01..2018-01-02:
|| 2018-01-01 2018-01-02 || 2018-01-01 2018-01-02
===++================================ ===++================================
@ -338,7 +338,7 @@ P 2018/01/26 SHARE €10
assets:bank assets:bank
$ hledger -f - bal -M --budget --cumulative --forecast -V $ hledger -f - bal -M --budget --cumulative --forecast -V
Budget performance in 2018-05-01-2018-06-30, valued at period ends: Budget performance in 2018-05-01..2018-06-30, valued at period ends:
|| May Jun || May Jun
================++========================================== ================++==========================================
@ -368,9 +368,9 @@ Budget performance in 2018-05-01-2018-06-30, valued at period ends:
liabilities $-30.00 liabilities $-30.00
$ hledger -f- bal --budget $ hledger -f- bal --budget
Budget performance in 2019-01-01-2019-01-03: Budget performance in 2019-01-01..2019-01-03:
|| 2019-01-01-2019-01-03 || 2019-01-01..2019-01-03
===================++============================== ===================++==============================
expenses || $50.00 [ 5% of $1,000.00] expenses || $50.00 [ 5% of $1,000.00]
expenses:personal || $50.00 [ 5% of $1,000.00] expenses:personal || $50.00 [ 5% of $1,000.00]
@ -380,9 +380,9 @@ Budget performance in 2019-01-01-2019-01-03:
# 17. # 17.
$ hledger -f- bal --budget -E $ hledger -f- bal --budget -E
Budget performance in 2019-01-01-2019-01-03: Budget performance in 2019-01-01..2019-01-03:
|| 2019-01-01-2019-01-03 || 2019-01-01..2019-01-03
========================================++============================== ========================================++==============================
expenses || $50.00 [ 5% of $1,000.00] expenses || $50.00 [ 5% of $1,000.00]
expenses:personal || $50.00 [ 5% of $1,000.00] expenses:personal || $50.00 [ 5% of $1,000.00]
@ -394,9 +394,9 @@ Budget performance in 2019-01-01-2019-01-03:
# 18. # 18.
$ hledger -f- bal --budget --tree $ hledger -f- bal --budget --tree
Budget performance in 2019-01-01-2019-01-03: Budget performance in 2019-01-01..2019-01-03:
|| 2019-01-01-2019-01-03 || 2019-01-01..2019-01-03
=============++============================== =============++==============================
expenses || $50.00 [ 5% of $1,000.00] expenses || $50.00 [ 5% of $1,000.00]
personal || $50.00 [ 5% of $1,000.00] personal || $50.00 [ 5% of $1,000.00]
@ -406,9 +406,9 @@ Budget performance in 2019-01-01-2019-01-03:
# 19. # 19.
$ hledger -f- bal --budget --tree -E $ hledger -f- bal --budget --tree -E
Budget performance in 2019-01-01-2019-01-03: Budget performance in 2019-01-01..2019-01-03:
|| 2019-01-01-2019-01-03 || 2019-01-01..2019-01-03
=================++============================== =================++==============================
expenses || $50.00 [ 5% of $1,000.00] expenses || $50.00 [ 5% of $1,000.00]
personal || $50.00 [ 5% of $1,000.00] personal || $50.00 [ 5% of $1,000.00]
@ -438,9 +438,9 @@ Budget performance in 2019-01-01-2019-01-03:
liabilities $-30.00 liabilities $-30.00
$ hledger -f- bal --budget $ hledger -f- bal --budget
Budget performance in 2019-01-01-2019-01-03: Budget performance in 2019-01-01..2019-01-03:
|| 2019-01-01-2019-01-03 || 2019-01-01..2019-01-03
===============================++============================== ===============================++==============================
expenses || $50.00 [ 5% of $1100.00] expenses || $50.00 [ 5% of $1100.00]
expenses:personal || $50.00 [ 5% of $1100.00] expenses:personal || $50.00 [ 5% of $1100.00]
@ -451,9 +451,9 @@ Budget performance in 2019-01-01-2019-01-03:
# 21. # 21.
$ hledger -f- bal --budget -E $ hledger -f- bal --budget -E
Budget performance in 2019-01-01-2019-01-03: Budget performance in 2019-01-01..2019-01-03:
|| 2019-01-01-2019-01-03 || 2019-01-01..2019-01-03
========================================++============================== ========================================++==============================
expenses || $50.00 [ 5% of $1100.00] expenses || $50.00 [ 5% of $1100.00]
expenses:personal || $50.00 [ 5% of $1100.00] expenses:personal || $50.00 [ 5% of $1100.00]
@ -465,9 +465,9 @@ Budget performance in 2019-01-01-2019-01-03:
# 22. # 22.
$ hledger -f- bal --budget --tree $ hledger -f- bal --budget --tree
Budget performance in 2019-01-01-2019-01-03: Budget performance in 2019-01-01..2019-01-03:
|| 2019-01-01-2019-01-03 || 2019-01-01..2019-01-03
=================++============================== =================++==============================
expenses || $50.00 [ 5% of $1100.00] expenses || $50.00 [ 5% of $1100.00]
personal || $50.00 [ 5% of $1100.00] personal || $50.00 [ 5% of $1100.00]
@ -478,9 +478,9 @@ Budget performance in 2019-01-01-2019-01-03:
# 23. # 23.
$ hledger -f- bal --budget --tree -E $ hledger -f- bal --budget --tree -E
Budget performance in 2019-01-01-2019-01-03: Budget performance in 2019-01-01..2019-01-03:
|| 2019-01-01-2019-01-03 || 2019-01-01..2019-01-03
=================++============================== =================++==============================
expenses || $50.00 [ 5% of $1100.00] expenses || $50.00 [ 5% of $1100.00]
personal || $50.00 [ 5% of $1100.00] personal || $50.00 [ 5% of $1100.00]
@ -515,37 +515,37 @@ Budget performance in 2019-01-01-2019-01-03:
# By default it hides d (because no budget) and e (because zero posted amount). # By default it hides d (because no budget) and e (because zero posted amount).
# f is shown though its budget is zero, it probably shouldn't be. # f is shown though its budget is zero, it probably shouldn't be.
$ hledger bal -f- --budget $ hledger bal -f- --budget
Budget performance in 2019-01-01-2019-01-02: Budget performance in 2019-01-01..2019-01-02:
|| 2019-01-01-2019-01-02 || 2019-01-01..2019-01-02
==================++======================= ==================++========================
expenses || $80 [ 22% of $370] expenses || $80 [ 22% of $370]
expenses:bills || $80 [ 22% of $370] expenses:bills || $80 [ 22% of $370]
expenses:bills:a || $10 [ 50% of $20] expenses:bills:a || $10 [ 50% of $20]
expenses:bills:b || $40 [ 20% of $200] expenses:bills:b || $40 [ 20% of $200]
expenses:bills:c || 0 [ 0% of $50] expenses:bills:c || 0 [ 0% of $50]
expenses:bills:f || $10 [ 0] expenses:bills:f || $10 [ 0]
income || $-80 [ 22% of $-370] income || $-80 [ 22% of $-370]
income:cash || $-80 [ 22% of $-370] income:cash || $-80 [ 22% of $-370]
------------------++----------------------- ------------------++------------------------
|| 0 [ 0] || 0 [ 0]
# 25. -E shows d # 25. -E shows d
$ hledger bal -f- --budget -E $ hledger bal -f- --budget -E
Budget performance in 2019-01-01-2019-01-02: Budget performance in 2019-01-01..2019-01-02:
|| 2019-01-01-2019-01-02 || 2019-01-01..2019-01-02
==================++======================= ==================++========================
expenses || $80 [ 22% of $370] expenses || $80 [ 22% of $370]
expenses:bills || $80 [ 22% of $370] expenses:bills || $80 [ 22% of $370]
expenses:bills:a || $10 [ 50% of $20] expenses:bills:a || $10 [ 50% of $20]
expenses:bills:b || $40 [ 20% of $200] expenses:bills:b || $40 [ 20% of $200]
expenses:bills:c || 0 [ 0% of $50] expenses:bills:c || 0 [ 0% of $50]
expenses:bills:d || $20 expenses:bills:d || $20
expenses:bills:e || 0 expenses:bills:e || 0
expenses:bills:f || $10 [ 0] expenses:bills:f || $10 [ 0]
income || $-80 [ 22% of $-370] income || $-80 [ 22% of $-370]
income:cash || $-80 [ 22% of $-370] income:cash || $-80 [ 22% of $-370]
------------------++----------------------- ------------------++------------------------
|| 0 [ 0] || 0 [ 0]

View File

@ -16,7 +16,7 @@ hledger -f sample.journal balance --no-total --depth 0
# 3. Ditto in a multi-column balance report. # 3. Ditto in a multi-column balance report.
hledger -f sample.journal balance -M -e 2008/4 --depth 0 hledger -f sample.journal balance -M -e 2008/4 --depth 0
>>> >>>
Balance changes in 2008/01: Balance changes in 2008-01:
|| Jan || Jan
=====++===== =====++=====

View File

@ -14,7 +14,7 @@ hledger -f balance-multicol.journal register
# 2. A period balance (flow) report. --no-total also works but isn't pretty. # 2. A period balance (flow) report. --no-total also works but isn't pretty.
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --no-total hledger -f balance-multicol.journal balance -p 'monthly in 2013' --no-total
>>> >>>
Balance changes in 2013q1: Balance changes in 2013Q1:
|| Jan Feb Mar || Jan Feb Mar
=================++=============== =================++===============
@ -36,7 +36,7 @@ hledger -f - balance -p 'quarterly in 2013' --empty
>>> >>>
Balance changes in 2013: Balance changes in 2013:
|| 2013q1 2013q2 2013q3 2013q4 || 2013Q1 2013Q2 2013Q3 2013Q4
===++================================ ===++================================
a || 2 0 0 0 a || 2 0 0 0
---++-------------------------------- ---++--------------------------------
@ -47,7 +47,7 @@ Balance changes in 2013:
# the highest-level displayed accounts (here, assets). # the highest-level displayed accounts (here, assets).
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --cumulative hledger -f balance-multicol.journal balance -p 'monthly in 2013' --cumulative
>>> >>>
Ending balances (cumulative) in 2013q1: Ending balances (cumulative) in 2013Q1:
|| 2013-01-31 2013-02-28 2013-03-31 || 2013-01-31 2013-02-28 2013-03-31
=================++==================================== =================++====================================
@ -63,7 +63,7 @@ Ending balances (cumulative) in 2013q1:
# includes the displayed subaccount and not the excluded one. # includes the displayed subaccount and not the excluded one.
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --cumulative not:cash hledger -f balance-multicol.journal balance -p 'monthly in 2013' --cumulative not:cash
>>> >>>
Ending balances (cumulative) in 2013q1: Ending balances (cumulative) in 2013Q1:
|| 2013-01-31 2013-02-28 2013-03-31 || 2013-01-31 2013-02-28 2013-03-31
=================++==================================== =================++====================================
@ -76,7 +76,7 @@ Ending balances (cumulative) in 2013q1:
# 6. A historical ending balance report. # 6. A historical ending balance report.
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --historical hledger -f balance-multicol.journal balance -p 'monthly in 2013' --historical
>>> >>>
Ending balances (historical) in 2013q1: Ending balances (historical) in 2013Q1:
|| 2013-01-31 2013-02-28 2013-03-31 || 2013-01-31 2013-02-28 2013-03-31
=================++==================================== =================++====================================
@ -91,7 +91,7 @@ Ending balances (historical) in 2013q1:
# the highest-level displayed accounts, now assets:cash and assets:checking. # the highest-level displayed accounts, now assets:cash and assets:checking.
hledger -f balance-multicol.journal balance -p 'monthly in 2013' not:assets$ hledger -f balance-multicol.journal balance -p 'monthly in 2013' not:assets$
>>> >>>
Balance changes in 2013q1: Balance changes in 2013Q1:
|| Jan Feb Mar || Jan Feb Mar
=================++=============== =================++===============
@ -104,7 +104,7 @@ Balance changes in 2013q1:
# 8. cumulative: # 8. cumulative:
hledger -f balance-multicol.journal balance -p 'monthly in 2013' not:assets$ --cumulative hledger -f balance-multicol.journal balance -p 'monthly in 2013' not:assets$ --cumulative
>>> >>>
Ending balances (cumulative) in 2013q1: Ending balances (cumulative) in 2013Q1:
|| 2013-01-31 2013-02-28 2013-03-31 || 2013-01-31 2013-02-28 2013-03-31
=================++==================================== =================++====================================
@ -117,7 +117,7 @@ Ending balances (cumulative) in 2013q1:
# 9. historical # 9. historical
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --historical hledger -f balance-multicol.journal balance -p 'monthly in 2013' --historical
>>> >>>
Ending balances (historical) in 2013q1: Ending balances (historical) in 2013Q1:
|| 2013-01-31 2013-02-28 2013-03-31 || 2013-01-31 2013-02-28 2013-03-31
=================++==================================== =================++====================================
@ -133,7 +133,7 @@ Ending balances (historical) in 2013q1:
# 10. A flow report with depth limiting. The depth limit aggregates the three accounts as "assets". # 10. A flow report with depth limiting. The depth limit aggregates the three accounts as "assets".
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 hledger -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1
>>> >>>
Balance changes in 2013q1: Balance changes in 2013Q1:
|| Jan Feb Mar || Jan Feb Mar
========++=============== ========++===============
@ -145,7 +145,7 @@ Balance changes in 2013q1:
# 11. As above, but postings in the top-level assets account have been excluded. # 11. As above, but postings in the top-level assets account have been excluded.
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 assets: hledger -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 assets:
>>> >>>
Balance changes in 2013q1: Balance changes in 2013Q1:
|| Jan Feb Mar || Jan Feb Mar
========++=============== ========++===============
@ -157,7 +157,7 @@ Balance changes in 2013q1:
# 12. A cumulative balance report with depth limiting. # 12. A cumulative balance report with depth limiting.
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 --cumulative hledger -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 --cumulative
>>> >>>
Ending balances (cumulative) in 2013q1: Ending balances (cumulative) in 2013Q1:
|| 2013-01-31 2013-02-28 2013-03-31 || 2013-01-31 2013-02-28 2013-03-31
========++==================================== ========++====================================
@ -169,7 +169,7 @@ Ending balances (cumulative) in 2013q1:
# 13. A historical balance report with depth limiting. # 13. A historical balance report with depth limiting.
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 --historical hledger -f balance-multicol.journal balance -p 'monthly in 2013' --depth 1 --historical
>>> >>>
Ending balances (historical) in 2013q1: Ending balances (historical) in 2013Q1:
|| 2013-01-31 2013-02-28 2013-03-31 || 2013-01-31 2013-02-28 2013-03-31
========++==================================== ========++====================================
@ -181,7 +181,7 @@ Ending balances (historical) in 2013q1:
# 14. The three multicol balance report types again, this time with --tree # 14. The three multicol balance report types again, this time with --tree
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --tree hledger -f balance-multicol.journal balance -p 'monthly in 2013' --tree
>>> >>>
Balance changes in 2013q1: Balance changes in 2013Q1:
|| Jan Feb Mar || Jan Feb Mar
============++=============== ============++===============
@ -195,7 +195,7 @@ Balance changes in 2013q1:
# 15. # 15.
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --cumulative --tree hledger -f balance-multicol.journal balance -p 'monthly in 2013' --cumulative --tree
>>> >>>
Ending balances (cumulative) in 2013q1: Ending balances (cumulative) in 2013Q1:
|| 2013-01-31 2013-02-28 2013-03-31 || 2013-01-31 2013-02-28 2013-03-31
============++==================================== ============++====================================
@ -209,7 +209,7 @@ Ending balances (cumulative) in 2013q1:
# 16. # 16.
hledger -f balance-multicol.journal balance -p 'monthly in 2013' --historical --tree hledger -f balance-multicol.journal balance -p 'monthly in 2013' --historical --tree
>>> >>>
Ending balances (historical) in 2013q1: Ending balances (historical) in 2013Q1:
|| 2013-01-31 2013-02-28 2013-03-31 || 2013-01-31 2013-02-28 2013-03-31
============++==================================== ============++====================================
@ -230,7 +230,7 @@ hledger -f- balance --monthly --date2
(b) 1 (b) 1
>>> >>>
Balance changes in 2014/01: Balance changes in 2014-01:
|| Jan || Jan
===++===== ===++=====
@ -253,7 +253,7 @@ hledger -f- balance -p 'monthly 2014/1/10-2014/2/20'
(after) 1 (after) 1
>>> >>>
Balance changes in 2014-01-01-2014-02-28: Balance changes in 2014-01-01..2014-02-28:
|| Jan Feb || Jan Feb
========++========== ========++==========

View File

@ -27,7 +27,7 @@ hledger -f sample.journal balance -% -p quarterly
>>> >>>
Balance changes in 2008: Balance changes in 2008:
|| 2008q1 2008q2 2008q3 2008q4 || 2008Q1 2008Q2 2008Q3 2008Q4
======================++================================ ======================++================================
assets:bank:checking || 0 0 0 0 assets:bank:checking || 0 0 0 0
assets:bank:saving || 0 0 0 0 assets:bank:saving || 0 0 0 0

View File

@ -1,6 +1,6 @@
hledger -f balance-multicol.journal balance --pretty-tables -M hledger -f balance-multicol.journal balance --pretty-tables -M
>>> >>>
Balance changes in 2012-12-01-2013-03-31: Balance changes in 2012-12-01..2013-03-31:
║ Dec Jan Feb Mar ║ Dec Jan Feb Mar
═════════════════╬════════════════════ ═════════════════╬════════════════════

View File

@ -1,6 +1,6 @@
hledger -f balance-multicol.journal balance -M -A --transpose hledger -f balance-multicol.journal balance -M -A --transpose
>>> >>>
Balance changes in 2012-12-01-2013-03-31: Balance changes in 2012-12-01..2013-03-31:
|| assets assets:cash assets:checking | || assets assets:cash assets:checking |
=========++======================================+==== =========++======================================+====
@ -14,10 +14,10 @@ Balance changes in 2012-12-01-2013-03-31:
hledger -f balance-multicol.journal balance -M -A -O csv --transpose hledger -f balance-multicol.journal balance -M -A -O csv --transpose
>>> >>>
"Account","assets","assets:cash","assets:checking","Total:" "Account","assets","assets:cash","assets:checking","Total:"
"2012/12","0","0","10","10" "2012-12","0","0","10","10"
"2013/01","0","0","0","0" "2013-01","0","0","0","0"
"2013/02","1","1","0","2" "2013-02","1","1","0","2"
"2013/03","0","0","1","1" "2013-03","0","0","1","1"
"Average","0","0","3","3" "Average","0","0","3","3"
>>>=0 >>>=0
@ -53,7 +53,7 @@ hledger bal -D -b 2016-12-01 -e 2016-12-04 -f - --budget
expenses:leisure $15 expenses:leisure $15
assets:cash assets:cash
>>> >>>
Budget performance in 2016-12-01-2016-12-03: Budget performance in 2016-12-01..2016-12-03:
|| 2016-12-01 2016-12-02 2016-12-03 || 2016-12-01 2016-12-02 2016-12-03
==================++================================================================== ==================++==================================================================

View File

@ -75,15 +75,15 @@ hledger -f - cashflow -b 2015 -e 2017
assets:checking $10.00 assets:checking $10.00
assets:receivables -$10.00 assets:receivables -$10.00
>>> >>>
Cashflow Statement 2015-01-01-2016-12-31 Cashflow Statement 2015-01-01..2016-12-31
|| 2015-01-01-2016-12-31 || 2015-01-01..2016-12-31
=================++======================= =================++========================
Cash flows || Cash flows ||
-----------------++----------------------- -----------------++------------------------
assets:checking || $9,960.00 assets:checking || $9,960.00
-----------------++----------------------- -----------------++------------------------
|| $9,960.00 || $9,960.00
>>>2 >>>2
>>>= 0 >>>= 0
@ -110,7 +110,7 @@ hledger -f - cashflow -b 2015/11 -e 2015/12
assets:checking $10.00 assets:checking $10.00
assets:receivables -$10.00 assets:receivables -$10.00
>>> >>>
Cashflow Statement 2015/11 Cashflow Statement 2015-11
|| Nov || Nov
=================++============ =================++============
@ -145,7 +145,7 @@ hledger -f - cashflow -b 2016/10 -e 2016/11
assets:checking $10.00 assets:checking $10.00
assets:receivables -$10.00 assets:receivables -$10.00
>>> >>>
Cashflow Statement 2016/10 Cashflow Statement 2016-10
|| Oct || Oct
============++===== ============++=====

View File

@ -1,23 +1,23 @@
# 1. all data files on the command line should be read # 1. all data files on the command line should be read
hledger inc -f personal.journal -f business.journal hledger inc -f personal.journal -f business.journal
>>> >>>
Income Statement 2014-01-01-2014-01-02 Income Statement 2014-01-01..2014-01-02
|| 2014-01-01-2014-01-02 || 2014-01-01..2014-01-02
==========================++======================= ==========================++========================
Revenues || Revenues ||
--------------------------++----------------------- --------------------------++------------------------
--------------------------++----------------------- --------------------------++------------------------
|| ||
==========================++======================= ==========================++========================
Expenses || Expenses ||
--------------------------++----------------------- --------------------------++------------------------
expenses:food || $1 expenses:food || $1
expenses:office supplies || $1 expenses:office supplies || $1
--------------------------++----------------------- --------------------------++------------------------
|| $2 || $2
==========================++======================= ==========================++========================
Net: || $-2 Net: || $-2
>>>2 >>>2
>>>=0 >>>=0

View File

@ -13,22 +13,22 @@
# The last report interval option takes precedence. # The last report interval option takes precedence.
$ hledger -f- register --weekly --monthly $ hledger -f- register --weekly --monthly
2019/01 a 2 2 2019-01 a 2 2
2019/02 a 1 3 2019-02 a 1 3
$ hledger -f- register --monthly --weekly $ hledger -f- register --monthly --weekly
2018-12-31w01 a 2 2 2018-12-31W01 a 2 2
2019-01-28w05 a 1 3 2019-01-28W05 a 1 3
# The last report interval option takes precedence. # The last report interval option takes precedence.
# The --period expression is no exception. # The --period expression is no exception.
$ hledger -f- register -p 'monthly in 2019' --weekly $ hledger -f- register -p 'monthly in 2019' --weekly
2018-12-31w01 a 2 2 2018-12-31W01 a 2 2
2019-01-28w05 a 1 3 2019-01-28W05 a 1 3
$ hledger -f- register --weekly -p 'monthly in 2019' $ hledger -f- register --weekly -p 'monthly in 2019'
2019/01 a 2 2 2019-01 a 2 2
2019/02 a 1 3 2019-02 a 1 3
@ -41,13 +41,13 @@ $ hledger -f- register --weekly -p 'monthly in 2019'
# -p 'monthly in 2019' # -p 'monthly in 2019'
$ hledger -f- register --monthly -p 2019 $ hledger -f- register --monthly -p 2019
2019/01 a 2 2 2019-01 a 2 2
2019/02 a 1 3 2019-02 a 1 3
$ hledger -f- register -p 2019 --monthly $ hledger -f- register -p 2019 --monthly
2019/01 a 2 2 2019-01 a 2 2
2019/02 a 1 3 2019-02 a 1 3
$ hledger -f- register -p 'monthly in 2019' $ hledger -f- register -p 'monthly in 2019'
2019/01 a 2 2 2019-01 a 2 2
2019/02 a 1 3 2019-02 a 1 3

View File

@ -16,7 +16,7 @@ hledger bal -M -b 2016-11 -e 2017-02 -f - --forecast
expenses:grocery $30 expenses:grocery $30
assets:cash assets:cash
>>> >>>
Balance changes in 2016-12-01-2017-01-31: Balance changes in 2016-12-01..2017-01-31:
|| Dec Jan || Dec Jan
==================++=============== ==================++===============
@ -169,7 +169,7 @@ hledger bal -M -b 2016-10 -e 2017-02 -f - --forecast=20160801-
income $-1000 income $-1000
assets:cash assets:cash
>>> >>>
Balance changes in 2016-10-01-2017-01-31: Balance changes in 2016-10-01..2017-01-31:
|| Oct Nov Dec Jan || Oct Nov Dec Jan
==================++================================ ==================++================================

View File

@ -90,24 +90,24 @@ hledger -f - incomestatement -b 2015 -e 2017
assets:checking $10.00 assets:checking $10.00
assets:receivables -$10.00 assets:receivables -$10.00
>>> >>>
Income Statement 2015-01-01-2016-12-31 Income Statement 2015-01-01..2016-12-31
|| 2015-01-01-2016-12-31 || 2015-01-01..2016-12-31
===================++======================= ===================++========================
Revenues || Revenues ||
-------------------++----------------------- -------------------++------------------------
revenue:clients:A || $10,000.00 revenue:clients:A || $10,000.00
revenue:clients:B || $10.00 revenue:clients:B || $10.00
-------------------++----------------------- -------------------++------------------------
|| $10,010.00 || $10,010.00
===================++======================= ===================++========================
Expenses || Expenses ||
-------------------++----------------------- -------------------++------------------------
expense:hosting || $50.00 expense:hosting || $50.00
-------------------++----------------------- -------------------++------------------------
|| $50.00 || $50.00
===================++======================= ===================++========================
Net: || $9,960.00 Net: || $9,960.00
>>>2 >>>2
>>>= 0 >>>= 0
@ -134,7 +134,7 @@ hledger -f - incomestatement -b 2015/10 -e 2015/11
assets:checking $10.00 assets:checking $10.00
assets:receivables -$10.00 assets:receivables -$10.00
>>> >>>
Income Statement 2015/10 Income Statement 2015-10
|| Oct || Oct
===================++============ ===================++============
@ -176,7 +176,7 @@ hledger -f - incomestatement -b 2016/10 -e 2016/11
assets:checking $10.00 assets:checking $10.00
assets:receivables -$10.00 assets:receivables -$10.00
>>> >>>
Income Statement 2016/10 Income Statement 2016-10
|| Oct || Oct
==========++===== ==========++=====
@ -198,7 +198,7 @@ Income Statement 2016/10
# old (arithmetic sign): # old (arithmetic sign):
# Income Statement # Income Statement
# #
# || 2008/01 2008/02 2008/03 2008/04 2008/05 2008/06 2008/07 2008/08 2008/09 2008/10 2008/11 2008/12 Total Average # || 2008/01 2008/02 2008/03 2008/04 2008/05 2008/06 2008/07 2008/08 2008/09 2008/10 2008/11 2008/12 Total Average
# ===================++============================================================================================================================== # ===================++==============================================================================================================================
# Revenues || # Revenues ||
# -------------------++------------------------------------------------------------------------------------------------------------------------------ # -------------------++------------------------------------------------------------------------------------------------------------------------------
@ -289,7 +289,7 @@ hledger -f sample.journal incomestatement -p 'quarterly 2008' -T --average -%
>>> >>>
Income Statement 2008 Income Statement 2008
|| 2008q1 2008q2 2008q3 2008q4 Total Average || 2008Q1 2008Q2 2008Q3 2008Q4 Total Average
===================++==================================================== ===================++====================================================
Revenues || Revenues ||
-------------------++---------------------------------------------------- -------------------++----------------------------------------------------

View File

@ -296,9 +296,9 @@ P 2000/04/01 A 4 B
(a) 1 A @ 9 B (a) 1 A @ 9 B
$ hledger -f- reg --value=cost -M $ hledger -f- reg --value=cost -M
2000/01 a 13 B 13 B 2000-01 a 13 B 13 B
2000/02 a 8 B 21 B 2000-02 a 8 B 21 B
2000/03 a 9 B 30 B 2000-03 a 9 B 30 B
# back to the original test journal: # back to the original test journal:
< <
@ -319,27 +319,27 @@ P 2000/04/01 A 4 B
# 25. periodic register report valued at period end # 25. periodic register report valued at period end
$ hledger -f- reg --value=end -M $ hledger -f- reg --value=end -M
2000/01 a 5 B 5 B 2000-01 a 5 B 5 B
2000/02 a 2 B 7 B 2000-02 a 2 B 7 B
2000/03 a 3 B 10 B 2000-03 a 3 B 10 B
# 26. periodic register report valued at specified date # 26. periodic register report valued at specified date
$ hledger -f- reg --value=2000-01-15 -M $ hledger -f- reg --value=2000-01-15 -M
2000/01 a 5 B 5 B 2000-01 a 5 B 5 B
2000/02 a 5 B 10 B 2000-02 a 5 B 10 B
2000/03 a 5 B 15 B 2000-03 a 5 B 15 B
# 27. periodic register report valued today # 27. periodic register report valued today
$ hledger -f- reg --value=now -M $ hledger -f- reg --value=now -M
2000/01 a 4 B 4 B 2000-01 a 4 B 4 B
2000/02 a 4 B 8 B 2000-02 a 4 B 8 B
2000/03 a 4 B 12 B 2000-03 a 4 B 12 B
# 28. periodic register report valued at default date (same as --value=end) # 28. periodic register report valued at default date (same as --value=end)
$ hledger -f- reg -V -M $ hledger -f- reg -V -M
2000/01 a 5 B 5 B 2000-01 a 5 B 5 B
2000/02 a 2 B 7 B 2000-02 a 2 B 7 B
2000/03 a 3 B 10 B 2000-03 a 3 B 10 B
# balance # balance
@ -367,7 +367,7 @@ $ hledger -f- bal -N -V
# 34. multicolumn balance report valued at cost # 34. multicolumn balance report valued at cost
$ hledger -f- bal -MTA --value=cost $ hledger -f- bal -MTA --value=cost
Balance changes in 2000q1, valued at cost: Balance changes in 2000Q1, valued at cost:
|| Jan Feb Mar Total Average || Jan Feb Mar Total Average
===++================================= ===++=================================
@ -377,7 +377,7 @@ Balance changes in 2000q1, valued at cost:
# 35. multicolumn balance report valued at period end # 35. multicolumn balance report valued at period end
$ hledger -f- bal -M --value=end $ hledger -f- bal -M --value=end
Balance changes in 2000q1, valued at period ends: Balance changes in 2000Q1, valued at period ends:
|| Jan Feb Mar || Jan Feb Mar
===++=============== ===++===============
@ -387,7 +387,7 @@ Balance changes in 2000q1, valued at period ends:
# 36. multicolumn balance report valued at period end with -T or -A # 36. multicolumn balance report valued at period end with -T or -A
$ hledger -f- bal -MTA --value=end $ hledger -f- bal -MTA --value=end
Balance changes in 2000q1, valued at period ends: Balance changes in 2000Q1, valued at period ends:
|| Jan Feb Mar Total Average || Jan Feb Mar Total Average
===++================================= ===++=================================
@ -397,7 +397,7 @@ Balance changes in 2000q1, valued at period ends:
# 37. multicolumn balance report valued at other date # 37. multicolumn balance report valued at other date
$ hledger -f- bal -MTA --value=2000-01-15 $ hledger -f- bal -MTA --value=2000-01-15
Balance changes in 2000q1, valued at 2000-01-15: Balance changes in 2000Q1, valued at 2000-01-15:
|| Jan Feb Mar Total Average || Jan Feb Mar Total Average
===++================================= ===++=================================
@ -407,7 +407,7 @@ Balance changes in 2000q1, valued at 2000-01-15:
# 38. multicolumn balance report valued today (with today >= 2000-04-01) # 38. multicolumn balance report valued today (with today >= 2000-04-01)
$ hledger -f- bal -M --value=now $ hledger -f- bal -M --value=now
Balance changes in 2000q1, current value: Balance changes in 2000Q1, current value:
|| Jan Feb Mar || Jan Feb Mar
===++=============== ===++===============
@ -417,7 +417,7 @@ Balance changes in 2000q1, current value:
# 39. multicolumn balance report valued at default date (same as --value=end) # 39. multicolumn balance report valued at default date (same as --value=end)
$ hledger -f- bal -M -V $ hledger -f- bal -M -V
Balance changes in 2000q1, valued at period ends: Balance changes in 2000Q1, valued at period ends:
|| Jan Feb Mar || Jan Feb Mar
===++=============== ===++===============
@ -432,7 +432,7 @@ Balance changes in 2000q1, valued at period ends:
# February adds 1 A costing 7 B, making 13 B. # February adds 1 A costing 7 B, making 13 B.
# March adds 1 A costing 8 B, making 21 B. # March adds 1 A costing 8 B, making 21 B.
$ hledger -f- bal -M -H -b 200002 --value=cost $ hledger -f- bal -M -H -b 200002 --value=cost
Ending balances (historical) in 2000-02-01-2000-03-31, valued at cost: Ending balances (historical) in 2000-02-01..2000-03-31, valued at cost:
|| 2000-02-29 2000-03-31 || 2000-02-29 2000-03-31
===++======================== ===++========================
@ -445,7 +445,7 @@ Ending balances (historical) in 2000-02-01-2000-03-31, valued at cost:
# February adds 1 A making 2 A, which is valued at 2000/02/29 as 4 B. # February adds 1 A making 2 A, which is valued at 2000/02/29 as 4 B.
# March adds 1 A making 3 A, which is valued at 2000/03/31 as 9 B. # March adds 1 A making 3 A, which is valued at 2000/03/31 as 9 B.
$ hledger -f- bal -MA -H -b 200002 --value=end $ hledger -f- bal -MA -H -b 200002 --value=end
Ending balances (historical) in 2000-02-01-2000-03-31, valued at period ends: Ending balances (historical) in 2000-02-01..2000-03-31, valued at period ends:
|| 2000-02-29 2000-03-31 Average || 2000-02-29 2000-03-31 Average
===++================================= ===++=================================
@ -456,7 +456,7 @@ Ending balances (historical) in 2000-02-01-2000-03-31, valued at period ends:
# 42. multicolumn balance report with -H valued at other date. # 42. multicolumn balance report with -H valued at other date.
# The starting balance is 5 B (1 A valued at 2000/1/15). # The starting balance is 5 B (1 A valued at 2000/1/15).
$ hledger -f- bal -M -H -b 200002 --value=2000-01-15 $ hledger -f- bal -M -H -b 200002 --value=2000-01-15
Ending balances (historical) in 2000-02-01-2000-03-31, valued at 2000-01-15: Ending balances (historical) in 2000-02-01..2000-03-31, valued at 2000-01-15:
|| 2000-02-29 2000-03-31 || 2000-02-29 2000-03-31
===++======================== ===++========================
@ -476,7 +476,7 @@ P 2000/04/01 A 4 B
(a) 1 A @ 6 B (a) 1 A @ 6 B
$ hledger -f- bal -ME -H -p200001-200004 --value=c $ hledger -f- bal -ME -H -p200001-200004 --value=c
Ending balances (historical) in 2000q1, valued at cost: Ending balances (historical) in 2000Q1, valued at cost:
|| 2000-01-31 2000-02-29 2000-03-31 || 2000-01-31 2000-02-29 2000-03-31
===++==================================== ===++====================================
@ -487,7 +487,7 @@ Ending balances (historical) in 2000q1, valued at cost:
# 44. multicolumn balance report with -H, valuing each period's carried-over balances at period end. # 44. multicolumn balance report with -H, valuing each period's carried-over balances at period end.
# Unrelated, also -H always disables -T. # Unrelated, also -H always disables -T.
$ hledger -f- bal -META -H -p200001-200004 --value=e $ hledger -f- bal -META -H -p200001-200004 --value=e
Ending balances (historical) in 2000q1, valued at period ends: Ending balances (historical) in 2000Q1, valued at period ends:
|| 2000-01-31 2000-02-29 2000-03-31 Average || 2000-01-31 2000-02-29 2000-03-31 Average
===++============================================= ===++=============================================
@ -497,7 +497,7 @@ Ending balances (historical) in 2000q1, valued at period ends:
# 45. multicolumn balance report with -H, valuing each period's carried-over balances at other date. # 45. multicolumn balance report with -H, valuing each period's carried-over balances at other date.
$ hledger -f- bal -ME -H -p200001-200004 --value=2000-01-15 $ hledger -f- bal -ME -H -p200001-200004 --value=2000-01-15
Ending balances (historical) in 2000q1, valued at 2000-01-15: Ending balances (historical) in 2000Q1, valued at 2000-01-15:
|| 2000-01-31 2000-02-29 2000-03-31 || 2000-01-31 2000-02-29 2000-03-31
===++==================================== ===++====================================
@ -529,7 +529,7 @@ P 2000/04/01 A 4 B
# 46. budget report, unvalued (for reference). # 46. budget report, unvalued (for reference).
$ hledger -f- bal -M --budget $ hledger -f- bal -M --budget
Budget performance in 2000q1: Budget performance in 2000Q1:
|| Jan Feb Mar || Jan Feb Mar
===++============================================================ ===++============================================================
@ -539,7 +539,7 @@ Budget performance in 2000q1:
# 47. budget report, valued at cost. # 47. budget report, valued at cost.
$ hledger -f- bal -MTA --budget --value=c $ hledger -f- bal -MTA --budget --value=c
Budget performance in 2000q1, valued at cost: Budget performance in 2000Q1, valued at cost:
|| Jan Feb Mar Total Average || Jan Feb Mar Total Average
===++===================================================================================================== ===++=====================================================================================================
@ -549,7 +549,7 @@ Budget performance in 2000q1, valued at cost:
# 48. budget report, valued at period ends. # 48. budget report, valued at period ends.
$ hledger -f- bal -MTA --budget --value=e $ hledger -f- bal -MTA --budget --value=e
Budget performance in 2000q1, valued at period ends: Budget performance in 2000Q1, valued at period ends:
|| Jan Feb Mar Total Average || Jan Feb Mar Total Average
===++========================================================================================================== ===++==========================================================================================================
@ -559,7 +559,7 @@ Budget performance in 2000q1, valued at period ends:
# 49. budget report, valued at other date. # 49. budget report, valued at other date.
$ hledger -f- bal -MTA --budget --value=2000-01-15 $ hledger -f- bal -MTA --budget --value=2000-01-15
Budget performance in 2000q1, valued at 2000-01-15: Budget performance in 2000Q1, valued at 2000-01-15:
|| Jan Feb Mar Total Average || Jan Feb Mar Total Average
===++========================================================================================================== ===++==========================================================================================================
@ -612,8 +612,8 @@ P 2020-04-01 A 4 B
(a) 1 A (a) 1 A
$ hledger -f- reg --value=then -Q $ hledger -f- reg --value=then -Q
2020q1 a 3 B 3 B 2020Q1 a 3 B 3 B
2020q2 a 4 B 7 B 2020Q2 a 4 B 7 B
>=0 >=0
# 52. print --value should affect all postings, including when there's an implicit transaction price # 52. print --value should affect all postings, including when there's an implicit transaction price

View File

@ -75,8 +75,8 @@ hledger -f- --pivot description reg -M
assets:bank account 2 EUR ; date:03/01 assets:bank account 2 EUR ; date:03/01
income:donations -2 EUR income:donations -2 EUR
>>> >>>
2016/02 Freifunk -2 EUR -2 EUR 2016-02 Freifunk -2 EUR -2 EUR
2016/03 Freifunk 2 EUR 0 2016-03 Freifunk 2 EUR 0
>>>=0 >>>=0
# pivot for implicit tag code (technical sample) # pivot for implicit tag code (technical sample)
@ -86,8 +86,8 @@ hledger -f- --pivot code reg -M
assets:bank account 2 EUR ; date:03/01 assets:bank account 2 EUR ; date:03/01
income:donations -2 EUR income:donations -2 EUR
>>> >>>
2016/02 Freifunk -2 EUR -2 EUR 2016-02 Freifunk -2 EUR -2 EUR
2016/03 Freifunk 2 EUR 0 2016-03 Freifunk 2 EUR 0
>>>=0 >>>=0
# use of pivot with code-based budgeting # use of pivot with code-based budgeting

View File

@ -4,7 +4,7 @@
(a) 1 (a) 1
$ hledger -f- register --period 'monthly' $ hledger -f- register --period 'monthly'
2011/02 a 1 1 2011-02 a 1 1
# 2. or with a query pattern, just the intervals with matched data: # 2. or with a query pattern, just the intervals with matched data:
< <
@ -15,7 +15,7 @@ $ hledger -f- register --period 'monthly'
(b) 1 (b) 1
$ hledger -f- register --period 'monthly' b $ hledger -f- register --period 'monthly' b
2011/02 b 1 1 2011-02 b 1 1
< <
2011/1/1 2011/1/1
@ -30,14 +30,14 @@ $ hledger -f- register --period 'monthly' b
# 3. with --empty, show all intervals spanned by the journal # 3. with --empty, show all intervals spanned by the journal
# (unlike current ledger, but more useful) # (unlike current ledger, but more useful)
$ hledger -f- register --period 'monthly' b --empty $ hledger -f- register --period 'monthly' b --empty
2011/01 0 0 2011-01 0 0
2011/02 b 1 1 2011-02 b 1 1
2011/03 0 1 2011-03 0 1
# 4. any specified begin/end dates limit the intervals reported # 4. any specified begin/end dates limit the intervals reported
$ hledger -f- register --period 'monthly to 2011/3/1' b --empty $ hledger -f- register --period 'monthly to 2011/3/1' b --empty
2011/01 0 0 2011-01 0 0
2011/02 b 1 1 2011-02 b 1 1
# 5. --date2 should work with intervals # 5. --date2 should work with intervals
< <
@ -48,7 +48,7 @@ $ hledger -f- register --period 'monthly to 2011/3/1' b --empty
(b) 1 (b) 1
$ hledger -f- register --monthly --date2 $ hledger -f- register --monthly --date2
2014/01 a 1 1 2014-01 a 1 1
b 1 2 b 1 2
# 6. All matched postings in the displayed intervals should be reported on. # 6. All matched postings in the displayed intervals should be reported on.
@ -63,7 +63,7 @@ $ hledger -f- register --monthly --date2
(after) 1 (after) 1
$ hledger -f- register -p 'monthly 2014/1/10-2014/2/20' $ hledger -f- register -p 'monthly 2014/1/10-2014/2/20'
2014/01 before 1 1 2014-01 before 1 1
2014/02 after 1 2 2014-02 after 1 2
within 1 3 within 1 3