diff --git a/CHANGES b/CHANGES
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,17 @@
 See also the project change log.
 
 
+# 1.3.1 (2017/8/25)
+
+* bs/is: don't let an empty subreport disable the grand totals (#588)
+
+* allow megaparsec 6 (#594)
+
+* allow megaparsec-6.1 (Hans-Peter Deifel)
+
+* restore upper bounds on hledger packages
+
+
 # 1.3 (2017/6/30)
 
 The "uncleared" transaction/posting status, and associated UI flags
@@ -12,7 +23,7 @@
 background. (#564)
 
 Also the -P short flag has been added for --pending, and the -U/-P/-C
-and flags can be combined. 
+flags can be combined. 
 
 bs/is: fix "Ratio has zero denominator" error (#535)
 
diff --git a/Hledger/Cli/Add.hs b/Hledger/Cli/Add.hs
--- a/Hledger/Cli/Add.hs
+++ b/Hledger/Cli/Add.hs
@@ -3,7 +3,7 @@
 |-}
 
 {-# OPTIONS_GHC -fno-warn-missing-signatures -fno-warn-unused-do-bind #-}
-{-# LANGUAGE CPP, ScopedTypeVariables, DeriveDataTypeable, RecordWildCards, TypeOperators, FlexibleContexts, OverloadedStrings #-}
+{-# LANGUAGE ScopedTypeVariables, DeriveDataTypeable, RecordWildCards, TypeOperators, FlexibleContexts, OverloadedStrings #-}
 
 module Hledger.Cli.Add
 where
@@ -16,6 +16,7 @@
 import Control.Monad.State.Strict (evalState, evalStateT)
 import Control.Monad.Trans (liftIO)
 import Data.Char (toUpper, toLower)
+import Data.Functor.Identity (Identity(..))
 import Data.List.Compat
 import qualified Data.Set as S
 import Data.Maybe
@@ -30,8 +31,7 @@
 import System.Console.Wizard
 import System.Console.Wizard.Haskeline
 import System.IO ( stderr, hPutStr, hPutStrLn )
-import Text.Megaparsec
-import Text.Megaparsec.Text
+import Text.Megaparsec.Compat
 import Text.Printf
 
 import Hledger
@@ -187,7 +187,7 @@
       parseSmartDateAndCode refdate s = either (const Nothing) (\(d,c) -> return (fixSmartDate refdate d, c)) edc
           where
             edc = runParser (dateandcodep <* eof) "" $ T.pack $ lowercase s
-            dateandcodep :: Parser (SmartDate, Text)
+            dateandcodep :: SimpleTextParser (SmartDate, Text)
             dateandcodep = do
                 d <- smartdate
                 c <- optional codep
@@ -285,7 +285,7 @@
                                   ""
                                   (T.pack s)
       nodefcommodityj = esJournal{jparsedefaultcommodity=Nothing}
-      amountandcommentp :: JournalParser (Amount, Text)
+      amountandcommentp :: JournalParser Identity (Amount, Text)
       amountandcommentp = do
         a <- amountp
         lift (many spacenonewline)
diff --git a/Hledger/Cli/BalanceView.hs b/Hledger/Cli/BalanceView.hs
deleted file mode 100644
--- a/Hledger/Cli/BalanceView.hs
+++ /dev/null
@@ -1,188 +0,0 @@
-{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
-{-|
-
-This module is used by the 'balancesheet', 'incomestatement', and
-'cashflow' commands to print out acocunt balances based on a specific
-"view", which consists of a title and multiple named queries that are
-aggregated and totaled.
-
--}
-
-module Hledger.Cli.BalanceView (
-  BalanceView(..)
- ,balanceviewmode
- ,balanceviewReport
-) where
-
-import Control.Monad (unless)
-import Data.List (intercalate, foldl', isPrefixOf)
-import Data.Maybe (fromMaybe)
-import Data.Monoid (Sum(..), (<>))
-import System.Console.CmdArgs.Explicit as C
-import Text.Tabular as T
-
-import Hledger
-import Hledger.Cli.Balance
-import Hledger.Cli.CliOptions
-
--- | Describes a view for the balance, which can consist of multiple
--- separate named queries that are aggregated and totaled.
-data BalanceView = BalanceView {
-      bvmode     :: String,                        -- ^ command line mode of the view
-      bvaliases  :: [String],                      -- ^ command line aliases
-      bvhelp     :: String,                        -- ^ command line help message
-      bvtitle    :: String,                        -- ^ title of the view
-      bvqueries  :: [(String, Journal -> Query)],  -- ^ named queries that make up the view
-      bvtype     :: BalanceType                    -- ^ the type of balance this view shows.
-                                                   --   This overrides user input.
-}
-
-balanceviewmode :: BalanceView -> Mode RawOpts
-balanceviewmode BalanceView{..} = (defCommandMode $ bvmode : bvaliases) {
-  modeHelp = bvhelp `withAliases` bvaliases
- ,modeGroupFlags = C.Group {
-     groupUnnamed = [
-      flagNone ["change"] (\opts -> setboolopt "change" opts)
-        ("show balance change in each period" ++ defType PeriodChange)
-     ,flagNone ["cumulative"] (\opts -> setboolopt "cumulative" opts)
-        ("show balance change accumulated across periods (in multicolumn reports)"
-            ++ defType CumulativeChange
-        )
-     ,flagNone ["historical","H"] (\opts -> setboolopt "historical" opts)
-        ("show historical ending balance in each period (includes postings before report start date)"
-            ++ defType HistoricalBalance
-        )
-     ,flagNone ["flat"] (\opts -> setboolopt "flat" opts) "show accounts as a list"
-     ,flagReq  ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"
-     ,flagNone ["no-total","N"] (\opts -> setboolopt "no-total" opts) "omit the final total row"
-     ,flagNone ["tree"] (\opts -> setboolopt "tree" opts) "show accounts as a tree; amounts include subaccounts (default in simple reports)"
-     ,flagNone ["average","A"] (\opts -> setboolopt "average" opts) "show a row average column (in multicolumn reports)"
-     ,flagNone ["row-total","T"] (\opts -> setboolopt "row-total" opts) "show a row total column (in multicolumn reports)"
-     ,flagNone ["no-elide"] (\opts -> setboolopt "no-elide" opts) "don't squash boring parent accounts (in tree mode)"
-     ,flagReq  ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"
-     ,flagNone ["pretty-tables"] (\opts -> setboolopt "pretty-tables" opts) "use unicode when displaying tables"
-     ]
-    ,groupHidden = []
-    ,groupNamed = [generalflagsgroup1]
-    }
- }
- where
-   defType :: BalanceType -> String
-   defType bt | bt == bvtype = " (default)"
-              | otherwise    = ""
-
-balanceviewQueryReport
-    :: ReportOpts
-    -> Query
-    -> Journal
-    -> String
-    -> (Journal -> Query)
-    -> ([String], Sum MixedAmount)
-balanceviewQueryReport ropts q0 j t q = ([view], Sum amt)
-    where
-      q' = And [q0, q j]
-      rep@(_ , amt)
-        -- For --historical/--cumulative, we must use multiBalanceReport.
-        -- (This forces --no-elide.)
-        -- See Balance.hs's implementation of 'balance' for more information
-        | balancetype_ ropts `elem` [HistoricalBalance, CumulativeChange]
-            = singleBalanceReport ropts q' j
-        | otherwise
-            = balanceReport ropts q' j
-      view = intercalate "\n" [t <> ":", balanceReportAsText ropts rep]
-
-multiBalanceviewQueryReport
-    :: ReportOpts
-    -> Query
-    -> Journal
-    -> String
-    -> (Journal -> Query)
-    -> ([Table String String MixedAmount], [[MixedAmount]], Sum MixedAmount)
-multiBalanceviewQueryReport ropts q0 j t q = ([tabl], [coltotals], Sum tot)
-    where
-      singlesection = "Cash" `isPrefixOf` t -- TODO temp
-      ropts' = ropts { no_total_ = singlesection && no_total_ ropts, empty_ = True }
-      q' = And [q0, q j]
-      MultiBalanceReport (dates, rows, (coltotals,tot,avg)) =
-          multiBalanceReport ropts' q' j
-      rows' | empty_ ropts = rows
-            | otherwise    = filter (not . emptyRow) rows
-        where
-          emptyRow (_,_,_,amts,_,_) = all isZeroMixedAmount amts
-      r = MultiBalanceReport (dates, rows', (coltotals, tot, avg))
-      Table hLeft hTop dat = balanceReportAsTable ropts' r
-      tabl = Table (T.Group SingleLine [Header t, hLeft]) hTop ([]:dat)
-
--- | Prints out a balance report according to a given view
-balanceviewReport :: BalanceView -> CliOpts -> Journal -> IO ()
-balanceviewReport BalanceView{..} CliOpts{command_=cmd, reportopts_=ropts, rawopts_=raw} j = do
-    currDay   <- getCurrentDay
-    let q0 = queryFromOpts currDay ropts'
-    let title = bvtitle ++ maybe "" (' ':) balanceclarification
-    case interval_ ropts' of
-      NoInterval -> do
-        let (views, amt) =
-              foldMap (uncurry (balanceviewQueryReport ropts' q0 j))
-                 bvqueries
-        mapM_ putStrLn (title : "" : views)
-
-        unless (no_total_ ropts' || cmd=="cashflow") . mapM_ putStrLn $ -- TODO temp
-          [ "Total:"
-          , "--------------------"
-          , padLeftWide 20 $ showamt (getSum amt)
-          ]
-      _ -> do
-        let (tabls, amts, Sum totsum)
-              = foldMap (uncurry (multiBalanceviewQueryReport ropts' q0 j)) bvqueries
-            sumAmts = case amts of
-              a1:as -> foldl' (zipWith (+)) a1 as
-              []    -> []
-            totavg = totsum `divideMixedAmount` fromIntegral (length sumAmts)
-            mergedTabl = case tabls of
-              t1:ts -> foldl' merging t1 ts
-              []    -> T.empty
-            totTabl
-              | no_total_ ropts' || length bvqueries == 1 =
-                  mergedTabl
-              | otherwise =
-                  mergedTabl
-                  +====+
-                  row "Total"
-                      (sumAmts ++ (if row_total_ ropts' && not (null sumAmts) then [totsum] else [])
-                               ++ (if average_ ropts' && not (null sumAmts)   then [totavg] else [])
-                      )
-        putStrLn title
-        putStrLn $ renderBalanceReportTable ropts totTabl
-  where
-    showamt | color_ ropts = cshowMixedAmountWithoutPrice
-            | otherwise    = showMixedAmountWithoutPrice
-    overwriteBalanceType =
-      case reverse $ filter (`elem` ["change","cumulative","historical"]) $ map fst raw of
-        "historical":_ -> Just HistoricalBalance
-        "cumulative":_ -> Just CumulativeChange
-        "change":_     -> Just PeriodChange
-        _              -> Nothing
-    balancetype = fromMaybe bvtype overwriteBalanceType
-    -- we must clarify that the statements aren't actual income statements,
-    -- etc. if the user overrides the balance type
-    balanceclarification = flip fmap overwriteBalanceType $ \t ->
-      case t of
-        PeriodChange      -> "(Balance Changes)"
-        CumulativeChange  -> "(Cumulative Ending Balances)"
-        HistoricalBalance -> "(Historical Ending Balances)"
-    ropts' = treeIfNotPeriod $ ropts { balancetype_ = balancetype }
-        -- For --historical/--cumulative, we must use multiBalanceReport.
-        -- (This forces --no-elide.)
-        -- These settings format the output in a way that we can convert to
-        -- a normal balance report using singleBalanceReport.  See
-        -- Balance.hs for more information.
-    treeIfNotPeriod
-      | flat_ ropts = id
-      | otherwise   = case (balancetype, interval_ ropts) of
-          (HistoricalBalance, NoInterval) -> \o ->
-              o { accountlistmode_ = ALTree }
-          (CumulativeChange , NoInterval) -> \o ->
-              o { accountlistmode_ = ALTree }
-          _                               -> id
-    merging (Table hLeft hTop dat) (Table hLeft' _ dat') =
-        Table (T.Group DoubleLine [hLeft, hLeft']) hTop (dat ++ dat')
diff --git a/Hledger/Cli/Balancesheet.hs b/Hledger/Cli/Balancesheet.hs
--- a/Hledger/Cli/Balancesheet.hs
+++ b/Hledger/Cli/Balancesheet.hs
@@ -17,28 +17,29 @@
 
 import Hledger
 import Hledger.Cli.CliOptions
-import Hledger.Cli.BalanceView
+import Hledger.Cli.CompoundBalanceCommand
 
-bsBV = BalanceView {
-         bvmode     = "balancesheet",
-         bvaliases  = ["bs"],
-         bvhelp     = [here|This command displays a simple balance sheet, showing historical ending
+balancesheetSpec = CompoundBalanceCommandSpec {
+  cbcname     = "balancesheet",
+  cbcaliases  = ["bs"],
+  cbchelp     = [here|
+This command displays a simple balance sheet, showing historical ending
 balances of asset and liability accounts (ignoring any report begin date). 
 It assumes that these accounts are under a top-level `asset` or `liability`
-account (plural forms also  allowed).
-          |],
-         bvtitle    = "Balance Sheet",
-         bvqueries  = [ ("Assets"     , journalAssetAccountQuery),
-                        ("Liabilities", journalLiabilityAccountQuery)
-                      ],
-         bvtype     = HistoricalBalance
-      }
+account (case insensitive, plural forms also  allowed).
+  |],
+  cbctitle    = "Balance Sheet",
+  cbcqueries  = [ ("Assets"     , journalAssetAccountQuery),
+                 ("Liabilities", journalLiabilityAccountQuery)
+               ],
+  cbctype     = HistoricalBalance
+}
 
 balancesheetmode :: Mode RawOpts
-balancesheetmode = balanceviewmode bsBV
+balancesheetmode = compoundBalanceCommandMode balancesheetSpec
 
 balancesheet :: CliOpts -> Journal -> IO ()
-balancesheet = balanceviewReport bsBV
+balancesheet = compoundBalanceCommand balancesheetSpec
 
 tests_Hledger_Cli_Balancesheet :: Test
 tests_Hledger_Cli_Balancesheet = TestList
diff --git a/Hledger/Cli/Cashflow.hs b/Hledger/Cli/Cashflow.hs
--- a/Hledger/Cli/Cashflow.hs
+++ b/Hledger/Cli/Cashflow.hs
@@ -20,26 +20,27 @@
 
 import Hledger
 import Hledger.Cli.CliOptions
-import Hledger.Cli.BalanceView
+import Hledger.Cli.CompoundBalanceCommand
 
-cfBV = BalanceView {
-         bvmode     = "cashflow",
-         bvaliases  = ["cf"],
-         bvhelp     = [here|This command displays a simple cashflow statement, showing changes
+cashflowSpec = CompoundBalanceCommandSpec {
+  cbcname     = "cashflow",
+  cbcaliases  = ["cf"],
+  cbchelp     = [here|
+This command displays a simple cashflow statement, showing changes
 in "cash" accounts. It assumes that these accounts are under a top-level 
-`asset` account and do not contain `receivable` or `A/R` in their name 
-(plural forms also allowed). 
-          |],
-         bvtitle    = "Cashflow Statement",
-         bvqueries  = [("Cash flows", journalCashAccountQuery)],
-         bvtype     = PeriodChange
-      }
+`asset` account (case insensitive, plural forms also allowed) and do not 
+contain `receivable` or `A/R` in their name. 
+  |],
+  cbctitle    = "Cashflow Statement",
+  cbcqueries  = [("Cash flows", journalCashAccountQuery)],
+  cbctype     = PeriodChange
+}
 
 cashflowmode :: Mode RawOpts
-cashflowmode = balanceviewmode cfBV
+cashflowmode = compoundBalanceCommandMode cashflowSpec
 
 cashflow :: CliOpts -> Journal -> IO ()
-cashflow = balanceviewReport cfBV
+cashflow = compoundBalanceCommand cashflowSpec
 
 tests_Hledger_Cli_Cashflow :: Test
 tests_Hledger_Cli_Cashflow = TestList
diff --git a/Hledger/Cli/CliOptions.hs b/Hledger/Cli/CliOptions.hs
--- a/Hledger/Cli/CliOptions.hs
+++ b/Hledger/Cli/CliOptions.hs
@@ -5,7 +5,7 @@
 
 -}
 
-{-# LANGUAGE CPP, ScopedTypeVariables, DeriveDataTypeable, FlexibleContexts, TypeFamilies #-}
+{-# LANGUAGE CPP, ScopedTypeVariables, DeriveDataTypeable, FlexibleContexts, TypeFamilies, OverloadedStrings #-}
 
 module Hledger.Cli.CliOptions (
 
@@ -90,7 +90,7 @@
 import System.Exit (exitSuccess)
 import System.FilePath
 import Test.HUnit
-import Text.Megaparsec
+import Text.Megaparsec.Compat
 
 import Hledger
 import Hledger.Cli.DocFiles
@@ -548,7 +548,7 @@
 widthFromOpts :: CliOpts -> Int
 widthFromOpts CliOpts{width_=Nothing, available_width_=w} = w
 widthFromOpts CliOpts{width_=Just s}  =
-    case runParser (read `fmap` some digitChar <* eof :: ParsecT Dec String Identity Int) "(unknown)" s of
+    case runParser (read `fmap` some digitChar <* eof :: ParsecT MPErr String Identity Int) "(unknown)" s of
         Left e   -> usageError $ "could not parse width option: "++show e
         Right w  -> w
 
@@ -570,7 +570,7 @@
         Left e   -> usageError $ "could not parse width option: "++show e
         Right ws -> ws
     where
-        registerwidthp :: (Stream s, Char ~ Token s) => ParsecT Dec s m (Int, Maybe Int)
+        registerwidthp :: (Stream s, Char ~ Token s) => ParsecT MPErr s m (Int, Maybe Int)
         registerwidthp = do
           totalwidth <- read `fmap` some digitChar
           descwidth <- optional (char ',' >> read `fmap` some digitChar)
@@ -660,10 +660,10 @@
 isHledgerExeName = isRight . parsewith hledgerexenamep . T.pack
     where
       hledgerexenamep = do
-        _ <- string progname
+        _ <- mptext $ T.pack progname
         _ <- char '-'
-        _ <- some (noneOf ".")
-        optional (string "." >> choice' (map string addonExtensions))
+        _ <- some $ noneOf ['.']
+        optional (string "." >> choice' (map (mptext . T.pack) addonExtensions))
         eof
 
 stripAddonExtension :: String -> String
diff --git a/Hledger/Cli/CompoundBalanceCommand.hs b/Hledger/Cli/CompoundBalanceCommand.hs
new file mode 100644
--- /dev/null
+++ b/Hledger/Cli/CompoundBalanceCommand.hs
@@ -0,0 +1,213 @@
+{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
+{-|
+
+Common helpers for making multi-section balance report commands 
+like balancesheet, cashflow, and incomestatement.
+
+-}
+
+module Hledger.Cli.CompoundBalanceCommand (
+  CompoundBalanceCommandSpec(..)
+ ,compoundBalanceCommandMode
+ ,compoundBalanceCommand
+) where
+
+import Control.Monad (unless)
+import Data.List (intercalate, foldl', isPrefixOf)
+import Data.Maybe (fromMaybe)
+import Data.Monoid (Sum(..), (<>))
+import System.Console.CmdArgs.Explicit as C
+import Text.Tabular as T
+
+import Hledger
+import Hledger.Cli.Balance
+import Hledger.Cli.CliOptions
+
+-- | Description of a compound balance report command, 
+-- from which we generate the command's cmdargs mode and IO action.
+-- A compound balance report shows one or more sections/subreports, 
+-- each with its own title and subtotals row, in a certain order, 
+-- plus a grand totals row if there's more than one section.
+-- Examples are the balancesheet, cashflow and incomestatement commands.
+data CompoundBalanceCommandSpec = CompoundBalanceCommandSpec {
+  cbcname     :: String,                        -- ^ command name
+  cbcaliases  :: [String],                      -- ^ command aliases
+  cbchelp     :: String,                        -- ^ command line help
+  cbctitle    :: String,                        -- ^ overall report title
+  cbcqueries  :: [(String, Journal -> Query)],  -- ^ title and (journal-parameterised) query for each subreport
+  cbctype     :: BalanceType                    -- ^ the type of "balance" this report shows (overrides command line flags)
+}
+
+-- | Generate a cmdargs option-parsing mode from a compound balance command 
+-- specification.
+compoundBalanceCommandMode :: CompoundBalanceCommandSpec -> Mode RawOpts
+compoundBalanceCommandMode CompoundBalanceCommandSpec{..} = (defCommandMode $ cbcname : cbcaliases) {
+  modeHelp = cbchelp `withAliases` cbcaliases
+ ,modeGroupFlags = C.Group {
+     groupUnnamed = [
+      flagNone ["change"] (\opts -> setboolopt "change" opts)
+        ("show balance change in each period" ++ defType PeriodChange)
+     ,flagNone ["cumulative"] (\opts -> setboolopt "cumulative" opts)
+        ("show balance change accumulated across periods (in multicolumn reports)"
+            ++ defType CumulativeChange
+        )
+     ,flagNone ["historical","H"] (\opts -> setboolopt "historical" opts)
+        ("show historical ending balance in each period (includes postings before report start date)"
+            ++ defType HistoricalBalance
+        )
+     ,flagNone ["flat"] (\opts -> setboolopt "flat" opts) "show accounts as a list"
+     ,flagReq  ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"
+     ,flagNone ["no-total","N"] (\opts -> setboolopt "no-total" opts) "omit the final total row"
+     ,flagNone ["tree"] (\opts -> setboolopt "tree" opts) "show accounts as a tree; amounts include subaccounts (default in simple reports)"
+     ,flagNone ["average","A"] (\opts -> setboolopt "average" opts) "show a row average column (in multicolumn reports)"
+     ,flagNone ["row-total","T"] (\opts -> setboolopt "row-total" opts) "show a row total column (in multicolumn reports)"
+     ,flagNone ["no-elide"] (\opts -> setboolopt "no-elide" opts) "don't squash boring parent accounts (in tree mode)"
+     ,flagReq  ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"
+     ,flagNone ["pretty-tables"] (\opts -> setboolopt "pretty-tables" opts) "use unicode when displaying tables"
+     ]
+    ,groupHidden = []
+    ,groupNamed = [generalflagsgroup1]
+    }
+ }
+ where
+   defType :: BalanceType -> String
+   defType bt | bt == cbctype = " (default)"
+              | otherwise    = ""
+
+-- | Generate a runnable command from a compound balance command specification.
+compoundBalanceCommand :: CompoundBalanceCommandSpec -> (CliOpts -> Journal -> IO ())
+compoundBalanceCommand CompoundBalanceCommandSpec{..} CliOpts{command_=cmd, reportopts_=ropts, rawopts_=rawopts} j = do
+    d <- getCurrentDay
+    let
+      -- use the default balance type for this report, unless the user overrides  
+      mBalanceTypeOverride =
+        case reverse $ filter (`elem` ["change","cumulative","historical"]) $ map fst rawopts of
+          "historical":_ -> Just HistoricalBalance
+          "cumulative":_ -> Just CumulativeChange
+          "change":_     -> Just PeriodChange
+          _              -> Nothing
+      balancetype = fromMaybe cbctype mBalanceTypeOverride
+      -- when user overrides, add an indication to the report title
+      title = cbctitle ++ maybe "" (' ':) mtitleclarification
+        where
+          mtitleclarification = flip fmap mBalanceTypeOverride $ \t ->
+            case t of
+              PeriodChange      -> "(Balance Changes)"
+              CumulativeChange  -> "(Cumulative Ending Balances)"
+              HistoricalBalance -> "(Historical Ending Balances)"
+      -- set balance type and possibly tree mode in the report options. Some older notes: 
+      -- For --historical/--cumulative, we must use multiBalanceReport (this forces --no-elide).
+      -- These settings format the output in a way that we can convert to a normal balance report 
+      -- using singleBalanceReport, see Balance.hs for more information.
+      ropts'
+        | not (flat_ ropts) && 
+          interval_ ropts==NoInterval && 
+          balancetype `elem` [CumulativeChange, HistoricalBalance]
+            = ropts{balancetype_=balancetype, accountlistmode_=ALTree}
+        | otherwise
+            = ropts{balancetype_=balancetype}
+      userq = queryFromOpts d ropts'
+
+    case interval_ ropts' of
+
+      -- single-column report
+      NoInterval -> do
+        let (subreportstr, total) = foldMap (uncurry (compoundBalanceCommandSingleColumnReport ropts' userq j)) cbcqueries
+        putStrLn $ title ++ "\n"
+        mapM_ putStrLn subreportstr
+        unless (no_total_ ropts' || cmd=="cashflow") . mapM_ putStrLn $ -- TODO temp
+          [ "Total:"
+          , "--------------------"
+          , padLeftWide 20 $ showamt (getSum total)
+          ]
+        where
+          showamt | color_ ropts' = cshowMixedAmountWithoutPrice
+                  | otherwise    = showMixedAmountWithoutPrice
+          
+      -- multi-column report
+      _ -> do
+        let
+          (subreporttables, subreporttotals, Sum overalltotal) = foldMap (uncurry (compoundBalanceCommandMultiColumnReports ropts' userq j)) cbcqueries
+          overalltable = case subreporttables of
+            t1:ts -> foldl' concatTables t1 ts
+            []    -> T.empty
+          overalltable'
+            | no_total_ ropts' || length cbcqueries == 1 =
+                overalltable
+            | otherwise =
+                overalltable
+                +====+
+                row "Total" overalltotals'
+              where
+                overalltotals = case subreporttotals of
+                  [] -> []
+                  ts -> foldl' (zipWith (+)) zeros ts'
+                    where
+                      -- A subreport might be empty and have no subtotals, count those as zeroes (#588).
+                      -- Varying-length subtotals rows are handled similarly, though that is not expected to happen.  
+                      len = maximum $ map length ts
+                      ts' = [take len $ as ++ repeat nullmixedamt | as <- ts]
+                      zeros = replicate len nullmixedamt
+                overalltotals'
+                  | null overalltotals = []
+                  | otherwise =  overalltotals
+                                 ++ (if row_total_ ropts' then [overalltotal]   else [])
+                                 ++ (if average_ ropts'   then [overallaverage] else [])
+                    where
+                      overallaverage = overalltotal `divideMixedAmount` fromIntegral (length overalltotals)
+        putStrLn title
+        putStrLn $ renderBalanceReportTable ropts' overalltable'
+
+-- Add the second table below the first, discarding its column headings.
+concatTables (Table hLeft hTop dat) (Table hLeft' _ dat') =
+    Table (T.Group DoubleLine [hLeft, hLeft']) hTop (dat ++ dat')
+
+-- | Run one subreport for a single-column compound balance command.
+-- Currently this returns the plain text rendering of the subreport,
+-- and its total.
+compoundBalanceCommandSingleColumnReport
+    :: ReportOpts
+    -> Query
+    -> Journal
+    -> String
+    -> (Journal -> Query)
+    -> ([String], Sum MixedAmount)
+compoundBalanceCommandSingleColumnReport ropts q0 j t q = ([view], Sum amt)
+    where
+      q' = And [q0, q j]
+      rep@(_ , amt)
+        -- For --historical/--cumulative, we must use multiBalanceReport.
+        -- (This forces --no-elide.)
+        -- See Balance.hs's implementation of 'balance' for more information
+        | balancetype_ ropts `elem` [HistoricalBalance, CumulativeChange]
+            = singleBalanceReport ropts q' j
+        | otherwise
+            = balanceReport ropts q' j
+      view = intercalate "\n" [t <> ":", balanceReportAsText ropts rep]
+
+-- | Run all the subreports for a multi-column compound balance command.
+-- Currently this returns a table of rendered balance amounts for each 
+-- subreport (including a totals row), the totals row for each subreport 
+-- (again, as mixedamounts), and the grand total.
+compoundBalanceCommandMultiColumnReports
+    :: ReportOpts
+    -> Query
+    -> Journal
+    -> String
+    -> (Journal -> Query)
+    -> ([Table String String MixedAmount], [[MixedAmount]], Sum MixedAmount)
+compoundBalanceCommandMultiColumnReports ropts q0 j t q = ([tabl], [coltotals], Sum tot)
+    where
+      singlesection = "Cash" `isPrefixOf` t -- TODO temp
+      ropts' = ropts { no_total_ = singlesection && no_total_ ropts, empty_ = True }
+      q' = And [q0, q j]
+      MultiBalanceReport (dates, rows, (coltotals,tot,avg)) =
+          multiBalanceReport ropts' q' j
+      rows' | empty_ ropts = rows
+            | otherwise    = filter (not . emptyRow) rows
+        where
+          emptyRow (_,_,_,amts,_,_) = all isZeroMixedAmount amts
+      r = MultiBalanceReport (dates, rows', (coltotals, tot, avg))
+      Table hLeft hTop dat = balanceReportAsTable ropts' r
+      tabl = Table (T.Group SingleLine [Header t, hLeft]) hTop ([]:dat)
+
diff --git a/Hledger/Cli/Incomestatement.hs b/Hledger/Cli/Incomestatement.hs
--- a/Hledger/Cli/Incomestatement.hs
+++ b/Hledger/Cli/Incomestatement.hs
@@ -1,7 +1,7 @@
 {-# LANGUAGE QuasiQuotes, TemplateHaskell, OverloadedStrings, NoCPP #-}
 {-|
 
-The @incomestatement@ command prints a simple income statement (profit & loss) report.
+The @incomestatement@ command prints a simple income statement (profit & loss report).
 
 -}
 
@@ -17,29 +17,29 @@
 
 import Hledger
 import Hledger.Cli.CliOptions
-import Hledger.Cli.BalanceView
+import Hledger.Cli.CompoundBalanceCommand
 
-isBV = BalanceView {
-         bvmode     = "incomestatement",
-         bvaliases  = ["is"],
-         bvhelp     = [here|This command displays a simple income statement, showing revenues
+incomestatementSpec = CompoundBalanceCommandSpec {
+  cbcname     = "incomestatement",
+  cbcaliases  = ["is"],
+  cbchelp     = [here|
+This command displays a simple income statement, showing revenues
 and expenses during a period. It assumes that these accounts are under a 
-top-level `revenue` or `income` or `expense` account (plural forms 
-also allowed).
-
-          |],
-         bvtitle    = "Income Statement",
-         bvqueries  = [ ("Revenues", journalIncomeAccountQuery),
-                        ("Expenses", journalExpenseAccountQuery)
-                      ],
-         bvtype     = PeriodChange
-      }
+top-level `revenue` or `income` or `expense` account (case insensitive,
+plural forms also allowed).
+  |],
+  cbctitle    = "Income Statement",
+  cbcqueries  = [ ("Revenues", journalIncomeAccountQuery),
+                 ("Expenses", journalExpenseAccountQuery)
+               ],
+  cbctype     = PeriodChange
+}
 
 incomestatementmode :: Mode RawOpts
-incomestatementmode = balanceviewmode isBV
+incomestatementmode = compoundBalanceCommandMode incomestatementSpec
 
 incomestatement :: CliOpts -> Journal -> IO ()
-incomestatement = balanceviewReport isBV
+incomestatement = compoundBalanceCommand incomestatementSpec
 
 tests_Hledger_Cli_Incomestatement :: Test
 tests_Hledger_Cli_Incomestatement = TestList
diff --git a/doc/hledger.1 b/doc/hledger.1
--- a/doc/hledger.1
+++ b/doc/hledger.1
@@ -1,6 +1,6 @@
 .\"t
 
-.TH "hledger" "1" "June 2017" "hledger 1.3" "hledger User Manuals"
+.TH "hledger" "1" "August 2017" "hledger 1.3.1" "hledger User Manuals"
 
 
 
diff --git a/doc/hledger.1.info b/doc/hledger.1.info
--- a/doc/hledger.1.info
+++ b/doc/hledger.1.info
@@ -3,8 +3,8 @@
 
 File: hledger.1.info,  Node: Top,  Next: EXAMPLES,  Up: (dir)
 
-hledger(1) hledger 1.3
-**********************
+hledger(1) hledger 1.3.1
+************************
 
 This is hledger's command-line interface (there are also curses and web
 interfaces).  Its basic function is to read a plain text file describing
@@ -2113,129 +2113,129 @@
 
 Tag Table:
 Node: Top70
-Node: EXAMPLES1886
-Ref: #examples1988
-Node: OPTIONS3634
-Ref: #options3738
-Node: General options4019
-Ref: #general-options4146
-Node: Command options6684
-Ref: #command-options6837
-Node: Command arguments7235
-Ref: #command-arguments7395
-Node: Special characters7516
-Ref: #special-characters7674
-Node: Input files8842
-Ref: #input-files8980
-Node: Smart dates10943
-Ref: #smart-dates11086
-Node: Report start & end date12065
-Ref: #report-start-end-date12237
-Node: Report intervals13303
-Ref: #report-intervals13468
-Node: Period expressions13869
-Ref: #period-expressions14029
-Node: Depth limiting16369
-Ref: #depth-limiting16515
-Node: Pivoting16716
-Ref: #pivoting16836
-Node: Cost18607
-Ref: #cost18717
-Node: Market value18835
-Ref: #market-value18972
-Node: Regular expressions20272
-Ref: #regular-expressions20410
-Node: QUERIES21771
-Ref: #queries21875
-Node: COMMANDS25540
-Ref: #commands25654
-Node: accounts26327
-Ref: #accounts26427
-Node: activity27409
-Ref: #activity27521
-Node: add27880
-Ref: #add27981
-Node: balance30639
-Ref: #balance30752
-Node: Flat mode33767
-Ref: #flat-mode33894
-Node: Depth limited balance reports34314
-Ref: #depth-limited-balance-reports34517
-Node: Multicolumn balance reports34937
-Ref: #multicolumn-balance-reports35148
-Node: Custom balance output39796
-Ref: #custom-balance-output39980
-Node: Colour support42073
-Ref: #colour-support42234
-Node: Output destination42407
-Ref: #output-destination42565
-Node: CSV output42835
-Ref: #csv-output42954
-Node: balancesheet43351
-Ref: #balancesheet43479
-Node: cashflow45386
-Ref: #cashflow45503
-Node: help47371
-Ref: #help47483
-Node: incomestatement48321
-Ref: #incomestatement48451
-Node: info50343
-Ref: #info50450
-Node: man50814
-Ref: #man50911
-Node: print51316
-Ref: #print51421
-Node: register55177
-Ref: #register55290
-Node: Custom register output59786
-Ref: #custom-register-output59917
-Node: stats61214
-Ref: #stats61320
-Node: test62201
-Ref: #test62288
-Node: ADD-ON COMMANDS62656
-Ref: #add-on-commands62768
-Node: Official add-ons64055
-Ref: #official-add-ons64197
-Node: api64284
-Ref: #api64375
-Node: ui64427
-Ref: #ui64528
-Node: web64586
-Ref: #web64677
-Node: Third party add-ons64723
-Ref: #third-party-add-ons64900
-Node: diff65035
-Ref: #diff65134
-Node: iadd65233
-Ref: #iadd65349
-Node: interest65432
-Ref: #interest65555
-Node: irr65650
-Ref: #irr65750
-Node: Experimental add-ons65828
-Ref: #experimental-add-ons65982
-Node: autosync66375
-Ref: #autosync66489
-Node: budget66728
-Ref: #budget66852
-Node: chart66918
-Ref: #chart67037
-Node: check67108
-Ref: #check67232
-Node: check-dates67299
-Ref: #check-dates67441
-Node: check-dupes67514
-Ref: #check-dupes67657
-Node: equity67734
-Ref: #equity67862
-Node: prices67981
-Ref: #prices68110
-Node: print-unique68165
-Ref: #print-unique68314
-Node: register-match68407
-Ref: #register-match68563
-Node: rewrite68661
-Ref: #rewrite68782
+Node: EXAMPLES1890
+Ref: #examples1992
+Node: OPTIONS3638
+Ref: #options3742
+Node: General options4023
+Ref: #general-options4150
+Node: Command options6688
+Ref: #command-options6841
+Node: Command arguments7239
+Ref: #command-arguments7399
+Node: Special characters7520
+Ref: #special-characters7678
+Node: Input files8846
+Ref: #input-files8984
+Node: Smart dates10947
+Ref: #smart-dates11090
+Node: Report start & end date12069
+Ref: #report-start-end-date12241
+Node: Report intervals13307
+Ref: #report-intervals13472
+Node: Period expressions13873
+Ref: #period-expressions14033
+Node: Depth limiting16373
+Ref: #depth-limiting16519
+Node: Pivoting16720
+Ref: #pivoting16840
+Node: Cost18611
+Ref: #cost18721
+Node: Market value18839
+Ref: #market-value18976
+Node: Regular expressions20276
+Ref: #regular-expressions20414
+Node: QUERIES21775
+Ref: #queries21879
+Node: COMMANDS25544
+Ref: #commands25658
+Node: accounts26331
+Ref: #accounts26431
+Node: activity27413
+Ref: #activity27525
+Node: add27884
+Ref: #add27985
+Node: balance30643
+Ref: #balance30756
+Node: Flat mode33771
+Ref: #flat-mode33898
+Node: Depth limited balance reports34318
+Ref: #depth-limited-balance-reports34521
+Node: Multicolumn balance reports34941
+Ref: #multicolumn-balance-reports35152
+Node: Custom balance output39800
+Ref: #custom-balance-output39984
+Node: Colour support42077
+Ref: #colour-support42238
+Node: Output destination42411
+Ref: #output-destination42569
+Node: CSV output42839
+Ref: #csv-output42958
+Node: balancesheet43355
+Ref: #balancesheet43483
+Node: cashflow45390
+Ref: #cashflow45507
+Node: help47375
+Ref: #help47487
+Node: incomestatement48325
+Ref: #incomestatement48455
+Node: info50347
+Ref: #info50454
+Node: man50818
+Ref: #man50915
+Node: print51320
+Ref: #print51425
+Node: register55181
+Ref: #register55294
+Node: Custom register output59790
+Ref: #custom-register-output59921
+Node: stats61218
+Ref: #stats61324
+Node: test62205
+Ref: #test62292
+Node: ADD-ON COMMANDS62660
+Ref: #add-on-commands62772
+Node: Official add-ons64059
+Ref: #official-add-ons64201
+Node: api64288
+Ref: #api64379
+Node: ui64431
+Ref: #ui64532
+Node: web64590
+Ref: #web64681
+Node: Third party add-ons64727
+Ref: #third-party-add-ons64904
+Node: diff65039
+Ref: #diff65138
+Node: iadd65237
+Ref: #iadd65353
+Node: interest65436
+Ref: #interest65559
+Node: irr65654
+Ref: #irr65754
+Node: Experimental add-ons65832
+Ref: #experimental-add-ons65986
+Node: autosync66379
+Ref: #autosync66493
+Node: budget66732
+Ref: #budget66856
+Node: chart66922
+Ref: #chart67041
+Node: check67112
+Ref: #check67236
+Node: check-dates67303
+Ref: #check-dates67445
+Node: check-dupes67518
+Ref: #check-dupes67661
+Node: equity67738
+Ref: #equity67866
+Node: prices67985
+Ref: #prices68114
+Node: print-unique68169
+Ref: #print-unique68318
+Node: register-match68411
+Ref: #register-match68567
+Node: rewrite68665
+Ref: #rewrite68786
 
 End Tag Table
diff --git a/doc/hledger.1.txt b/doc/hledger.1.txt
--- a/doc/hledger.1.txt
+++ b/doc/hledger.1.txt
@@ -1878,4 +1878,4 @@
 
 
 
-hledger 1.3                        June 2017                        hledger(1)
+hledger 1.3.1                     August 2017                       hledger(1)
diff --git a/doc/other/hledger-api.1 b/doc/other/hledger-api.1
--- a/doc/other/hledger-api.1
+++ b/doc/other/hledger-api.1
@@ -1,5 +1,5 @@
 
-.TH "hledger\-api" "1" "June 2017" "hledger\-api 1.3" "hledger User Manuals"
+.TH "hledger\-api" "1" "August 2017" "hledger\-api 1.3.1" "hledger User Manuals"
 
 
 
diff --git a/doc/other/hledger-api.1.info b/doc/other/hledger-api.1.info
--- a/doc/other/hledger-api.1.info
+++ b/doc/other/hledger-api.1.info
@@ -3,8 +3,8 @@
 
 File: hledger-api.1.info,  Node: Top,  Next: OPTIONS,  Up: (dir)
 
-hledger-api(1) hledger-api 1.3
-******************************
+hledger-api(1) hledger-api 1.3.1
+********************************
 
 hledger-api is a simple web API server, intended to support client-side
 web apps operating on hledger data.  It comes with a series of simple
@@ -73,7 +73,7 @@
 
 Tag Table:
 Node: Top74
-Node: OPTIONS1220
-Ref: #options1307
+Node: OPTIONS1224
+Ref: #options1311
 
 End Tag Table
diff --git a/doc/other/hledger-api.1.txt b/doc/other/hledger-api.1.txt
--- a/doc/other/hledger-api.1.txt
+++ b/doc/other/hledger-api.1.txt
@@ -107,4 +107,4 @@
 
 
 
-hledger-api 1.3                    June 2017                    hledger-api(1)
+hledger-api 1.3.1                 August 2017                   hledger-api(1)
diff --git a/doc/other/hledger-ui.1 b/doc/other/hledger-ui.1
--- a/doc/other/hledger-ui.1
+++ b/doc/other/hledger-ui.1
@@ -1,5 +1,5 @@
 
-.TH "hledger\-ui" "1" "June 2017" "hledger\-ui 1.3" "hledger User Manuals"
+.TH "hledger\-ui" "1" "August 2017" "hledger\-ui 1.3.1" "hledger User Manuals"
 
 
 
diff --git a/doc/other/hledger-ui.1.info b/doc/other/hledger-ui.1.info
--- a/doc/other/hledger-ui.1.info
+++ b/doc/other/hledger-ui.1.info
@@ -3,8 +3,8 @@
 
 File: hledger-ui.1.info,  Node: Top,  Next: OPTIONS,  Up: (dir)
 
-hledger-ui(1) hledger-ui 1.3
-****************************
+hledger-ui(1) hledger-ui 1.3.1
+******************************
 
 hledger-ui is hledger's curses-style interface, providing an efficient
 full-window text UI for viewing accounts and transactions, and some
@@ -365,19 +365,19 @@
 
 Tag Table:
 Node: Top73
-Node: OPTIONS825
-Ref: #options924
-Node: KEYS3665
-Ref: #keys3762
-Node: SCREENS6558
-Ref: #screens6645
-Node: Accounts screen6735
-Ref: #accounts-screen6865
-Node: Register screen9095
-Ref: #register-screen9252
-Node: Transaction screen11326
-Ref: #transaction-screen11486
-Node: Error screen12356
-Ref: #error-screen12480
+Node: OPTIONS829
+Ref: #options928
+Node: KEYS3669
+Ref: #keys3766
+Node: SCREENS6562
+Ref: #screens6649
+Node: Accounts screen6739
+Ref: #accounts-screen6869
+Node: Register screen9099
+Ref: #register-screen9256
+Node: Transaction screen11330
+Ref: #transaction-screen11490
+Node: Error screen12360
+Ref: #error-screen12484
 
 End Tag Table
diff --git a/doc/other/hledger-ui.1.txt b/doc/other/hledger-ui.1.txt
--- a/doc/other/hledger-ui.1.txt
+++ b/doc/other/hledger-ui.1.txt
@@ -369,4 +369,4 @@
 
 
 
-hledger-ui 1.3                     June 2017                     hledger-ui(1)
+hledger-ui 1.3.1                  August 2017                    hledger-ui(1)
diff --git a/doc/other/hledger-web.1 b/doc/other/hledger-web.1
--- a/doc/other/hledger-web.1
+++ b/doc/other/hledger-web.1
@@ -1,5 +1,5 @@
 
-.TH "hledger\-web" "1" "June 2017" "hledger\-web 1.3" "hledger User Manuals"
+.TH "hledger\-web" "1" "August 2017" "hledger\-web 1.3.1" "hledger User Manuals"
 
 
 
diff --git a/doc/other/hledger-web.1.info b/doc/other/hledger-web.1.info
--- a/doc/other/hledger-web.1.info
+++ b/doc/other/hledger-web.1.info
@@ -3,8 +3,8 @@
 
 File: hledger-web.1.info,  Node: Top,  Next: OPTIONS,  Up: (dir)
 
-hledger-web(1) hledger-web 1.3
-******************************
+hledger-web(1) hledger-web 1.3.1
+********************************
 
 hledger-web is hledger's web interface.  It starts a simple web
 application for browsing and adding transactions, and optionally opens
@@ -201,7 +201,7 @@
 
 Tag Table:
 Node: Top74
-Node: OPTIONS3156
-Ref: #options3243
+Node: OPTIONS3160
+Ref: #options3247
 
 End Tag Table
diff --git a/doc/other/hledger-web.1.txt b/doc/other/hledger-web.1.txt
--- a/doc/other/hledger-web.1.txt
+++ b/doc/other/hledger-web.1.txt
@@ -237,4 +237,4 @@
 
 
 
-hledger-web 1.3                    June 2017                    hledger-web(1)
+hledger-web 1.3.1                 August 2017                   hledger-web(1)
diff --git a/doc/other/hledger_csv.5 b/doc/other/hledger_csv.5
--- a/doc/other/hledger_csv.5
+++ b/doc/other/hledger_csv.5
@@ -1,5 +1,5 @@
 
-.TH "hledger_csv" "5" "June 2017" "hledger 1.3" "hledger User Manuals"
+.TH "hledger_csv" "5" "August 2017" "hledger 1.3.1" "hledger User Manuals"
 
 
 
diff --git a/doc/other/hledger_csv.5.info b/doc/other/hledger_csv.5.info
--- a/doc/other/hledger_csv.5.info
+++ b/doc/other/hledger_csv.5.info
@@ -3,8 +3,8 @@
 
 File: hledger_csv.5.info,  Node: Top,  Next: CSV RULES,  Up: (dir)
 
-hledger_csv(5) hledger 1.3
-**************************
+hledger_csv(5) hledger 1.3.1
+****************************
 
 hledger can read CSV files, converting each CSV record into a journal
 entry (transaction), if you provide some conversion hints in a "rules
@@ -201,21 +201,21 @@
 
 Tag Table:
 Node: Top74
-Node: CSV RULES810
-Ref: #csv-rules920
-Node: skip1163
-Ref: #skip1259
-Node: date-format1431
-Ref: #date-format1560
-Node: field list2066
-Ref: #field-list2205
-Node: field assignment2910
-Ref: #field-assignment3067
-Node: conditional block3571
-Ref: #conditional-block3727
-Node: include4623
-Ref: #include4734
-Node: CSV TIPS4965
-Ref: #csv-tips5061
+Node: CSV RULES814
+Ref: #csv-rules924
+Node: skip1167
+Ref: #skip1263
+Node: date-format1435
+Ref: #date-format1564
+Node: field list2070
+Ref: #field-list2209
+Node: field assignment2914
+Ref: #field-assignment3071
+Node: conditional block3575
+Ref: #conditional-block3731
+Node: include4627
+Ref: #include4738
+Node: CSV TIPS4969
+Ref: #csv-tips5065
 
 End Tag Table
diff --git a/doc/other/hledger_csv.5.txt b/doc/other/hledger_csv.5.txt
--- a/doc/other/hledger_csv.5.txt
+++ b/doc/other/hledger_csv.5.txt
@@ -171,4 +171,4 @@
 
 
 
-hledger 1.3                        June 2017                    hledger_csv(5)
+hledger 1.3.1                     August 2017                   hledger_csv(5)
diff --git a/doc/other/hledger_journal.5 b/doc/other/hledger_journal.5
--- a/doc/other/hledger_journal.5
+++ b/doc/other/hledger_journal.5
@@ -1,6 +1,6 @@
 .\"t
 
-.TH "hledger_journal" "5" "June 2017" "hledger 1.3" "hledger User Manuals"
+.TH "hledger_journal" "5" "August 2017" "hledger 1.3.1" "hledger User Manuals"
 
 
 
diff --git a/doc/other/hledger_journal.5.info b/doc/other/hledger_journal.5.info
--- a/doc/other/hledger_journal.5.info
+++ b/doc/other/hledger_journal.5.info
@@ -4,8 +4,8 @@
 
 File: hledger_journal.5.info,  Node: Top,  Next: FILE FORMAT,  Up: (dir)
 
-hledger_journal(5) hledger 1.3
-******************************
+hledger_journal(5) hledger 1.3.1
+********************************
 
 hledger's usual data source is a plain text file containing journal
 entries in hledger journal format.  This file represents a standard
@@ -1047,83 +1047,83 @@
 
 Tag Table:
 Node: Top78
-Node: FILE FORMAT2292
-Ref: #file-format2418
-Node: Transactions2625
-Ref: #transactions2748
-Node: Postings3313
-Ref: #postings3442
-Node: Dates4437
-Ref: #dates4554
-Node: Simple dates4619
-Ref: #simple-dates4747
-Node: Secondary dates5113
-Ref: #secondary-dates5269
-Node: Posting dates6832
-Ref: #posting-dates6963
-Node: Status8337
-Ref: #status8461
-Node: Account names10175
-Ref: #account-names10315
-Node: Amounts10802
-Ref: #amounts10940
-Node: Virtual Postings13041
-Ref: #virtual-postings13202
-Node: Balance Assertions14422
-Ref: #balance-assertions14599
-Node: Assertions and ordering15495
-Ref: #assertions-and-ordering15683
-Node: Assertions and included files16383
-Ref: #assertions-and-included-files16626
-Node: Assertions and multiple -f options16959
-Ref: #assertions-and-multiple--f-options17215
-Node: Assertions and commodities17347
-Ref: #assertions-and-commodities17584
-Node: Assertions and subaccounts18280
-Ref: #assertions-and-subaccounts18514
-Node: Assertions and virtual postings19035
-Ref: #assertions-and-virtual-postings19244
-Node: Balance Assignments19386
-Ref: #balance-assignments19555
-Node: Prices20674
-Ref: #prices20809
-Node: Transaction prices20860
-Ref: #transaction-prices21007
-Node: Market prices23163
-Ref: #market-prices23300
-Node: Comments24260
-Ref: #comments24384
-Node: Tags25497
-Ref: #tags25617
-Node: Implicit tags27046
-Ref: #implicit-tags27154
-Node: Directives27671
-Ref: #directives27786
-Node: Account aliases27979
-Ref: #account-aliases28125
-Node: Basic aliases28729
-Ref: #basic-aliases28874
-Node: Regex aliases29564
-Ref: #regex-aliases29734
-Node: Multiple aliases30449
-Ref: #multiple-aliases30623
-Node: end aliases31121
-Ref: #end-aliases31263
-Node: account directive31364
-Ref: #account-directive31546
-Node: apply account directive31842
-Ref: #apply-account-directive32040
-Node: Multi-line comments32699
-Ref: #multi-line-comments32891
-Node: commodity directive33019
-Ref: #commodity-directive33205
-Node: Default commodity34077
-Ref: #default-commodity34252
-Node: Default year34789
-Ref: #default-year34956
-Node: Including other files35379
-Ref: #including-other-files35538
-Node: EDITOR SUPPORT35935
-Ref: #editor-support36055
+Node: FILE FORMAT2296
+Ref: #file-format2422
+Node: Transactions2629
+Ref: #transactions2752
+Node: Postings3317
+Ref: #postings3446
+Node: Dates4441
+Ref: #dates4558
+Node: Simple dates4623
+Ref: #simple-dates4751
+Node: Secondary dates5117
+Ref: #secondary-dates5273
+Node: Posting dates6836
+Ref: #posting-dates6967
+Node: Status8341
+Ref: #status8465
+Node: Account names10179
+Ref: #account-names10319
+Node: Amounts10806
+Ref: #amounts10944
+Node: Virtual Postings13045
+Ref: #virtual-postings13206
+Node: Balance Assertions14426
+Ref: #balance-assertions14603
+Node: Assertions and ordering15499
+Ref: #assertions-and-ordering15687
+Node: Assertions and included files16387
+Ref: #assertions-and-included-files16630
+Node: Assertions and multiple -f options16963
+Ref: #assertions-and-multiple--f-options17219
+Node: Assertions and commodities17351
+Ref: #assertions-and-commodities17588
+Node: Assertions and subaccounts18284
+Ref: #assertions-and-subaccounts18518
+Node: Assertions and virtual postings19039
+Ref: #assertions-and-virtual-postings19248
+Node: Balance Assignments19390
+Ref: #balance-assignments19559
+Node: Prices20678
+Ref: #prices20813
+Node: Transaction prices20864
+Ref: #transaction-prices21011
+Node: Market prices23167
+Ref: #market-prices23304
+Node: Comments24264
+Ref: #comments24388
+Node: Tags25501
+Ref: #tags25621
+Node: Implicit tags27050
+Ref: #implicit-tags27158
+Node: Directives27675
+Ref: #directives27790
+Node: Account aliases27983
+Ref: #account-aliases28129
+Node: Basic aliases28733
+Ref: #basic-aliases28878
+Node: Regex aliases29568
+Ref: #regex-aliases29738
+Node: Multiple aliases30453
+Ref: #multiple-aliases30627
+Node: end aliases31125
+Ref: #end-aliases31267
+Node: account directive31368
+Ref: #account-directive31550
+Node: apply account directive31846
+Ref: #apply-account-directive32044
+Node: Multi-line comments32703
+Ref: #multi-line-comments32895
+Node: commodity directive33023
+Ref: #commodity-directive33209
+Node: Default commodity34081
+Ref: #default-commodity34256
+Node: Default year34793
+Ref: #default-year34960
+Node: Including other files35383
+Ref: #including-other-files35542
+Node: EDITOR SUPPORT35939
+Ref: #editor-support36059
 
 End Tag Table
diff --git a/doc/other/hledger_journal.5.txt b/doc/other/hledger_journal.5.txt
--- a/doc/other/hledger_journal.5.txt
+++ b/doc/other/hledger_journal.5.txt
@@ -835,4 +835,4 @@
 
 
 
-hledger 1.3                        June 2017                hledger_journal(5)
+hledger 1.3.1                     August 2017               hledger_journal(5)
diff --git a/doc/other/hledger_timeclock.5 b/doc/other/hledger_timeclock.5
--- a/doc/other/hledger_timeclock.5
+++ b/doc/other/hledger_timeclock.5
@@ -1,5 +1,5 @@
 
-.TH "hledger_timeclock" "5" "June 2017" "hledger 1.3" "hledger User Manuals"
+.TH "hledger_timeclock" "5" "August 2017" "hledger 1.3.1" "hledger User Manuals"
 
 
 
diff --git a/doc/other/hledger_timeclock.5.info b/doc/other/hledger_timeclock.5.info
--- a/doc/other/hledger_timeclock.5.info
+++ b/doc/other/hledger_timeclock.5.info
@@ -4,8 +4,8 @@
 
 File: hledger_timeclock.5.info,  Node: Top,  Up: (dir)
 
-hledger_timeclock(5) hledger 1.3
-********************************
+hledger_timeclock(5) hledger 1.3.1
+**********************************
 
 hledger can read timeclock files.  As with Ledger, these are (a subset
 of) timeclock.el's format, containing clock-in and clock-out entries as
diff --git a/doc/other/hledger_timeclock.5.txt b/doc/other/hledger_timeclock.5.txt
--- a/doc/other/hledger_timeclock.5.txt
+++ b/doc/other/hledger_timeclock.5.txt
@@ -79,4 +79,4 @@
 
 
 
-hledger 1.3                        June 2017              hledger_timeclock(5)
+hledger 1.3.1                     August 2017             hledger_timeclock(5)
diff --git a/doc/other/hledger_timedot.5 b/doc/other/hledger_timedot.5
--- a/doc/other/hledger_timedot.5
+++ b/doc/other/hledger_timedot.5
@@ -1,5 +1,5 @@
 
-.TH "hledger_timedot" "5" "June 2017" "hledger 1.3" "hledger User Manuals"
+.TH "hledger_timedot" "5" "August 2017" "hledger 1.3.1" "hledger User Manuals"
 
 
 
diff --git a/doc/other/hledger_timedot.5.info b/doc/other/hledger_timedot.5.info
--- a/doc/other/hledger_timedot.5.info
+++ b/doc/other/hledger_timedot.5.info
@@ -4,8 +4,8 @@
 
 File: hledger_timedot.5.info,  Node: Top,  Next: FILE FORMAT,  Up: (dir)
 
-hledger_timedot(5) hledger 1.3
-******************************
+hledger_timedot(5) hledger 1.3.1
+********************************
 
 Timedot is a plain text format for logging dated, categorised quantities
 (eg time), supported by hledger.  It is convenient for approximate and
@@ -106,7 +106,7 @@
 
 Tag Table:
 Node: Top78
-Node: FILE FORMAT882
-Ref: #file-format985
+Node: FILE FORMAT886
+Ref: #file-format989
 
 End Tag Table
diff --git a/doc/other/hledger_timedot.5.txt b/doc/other/hledger_timedot.5.txt
--- a/doc/other/hledger_timedot.5.txt
+++ b/doc/other/hledger_timedot.5.txt
@@ -120,4 +120,4 @@
 
 
 
-hledger 1.3                        June 2017                hledger_timedot(5)
+hledger 1.3.1                     August 2017               hledger_timedot(5)
diff --git a/hledger.cabal b/hledger.cabal
--- a/hledger.cabal
+++ b/hledger.cabal
@@ -1,9 +1,9 @@
--- This file has been generated from package.yaml by hpack version 0.17.0.
+-- This file has been generated from package.yaml by hpack version 0.17.1.
 --
 -- see: https://github.com/sol/hpack
 
 name:           hledger
-version:        1.3
+version:        1.3.1
 synopsis:       Command-line interface for the hledger accounting tool
 description:    This is hledger's command-line interface.
                 Its basic function is to read a plain text file describing
@@ -80,7 +80,7 @@
 
 library
   ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans
-  cpp-options: -DVERSION="1.3"
+  cpp-options: -DVERSION="1.3.1"
   build-depends:
       base >=4.8 && <5
     , base-compat >=0.8.1
@@ -93,7 +93,7 @@
     , process
     , temporary
     , tabular >=0.2 && <0.3
-    , hledger-lib >= 1.3
+    , hledger-lib >= 1.3.1 && < 1.4
     , bytestring
     , containers
     , unordered-containers
@@ -106,7 +106,7 @@
     , mtl
     , mtl-compat
     , old-time
-    , megaparsec >=5.0 && < 5.4
+    , megaparsec >=5.0 && < 6.2
     , regex-tdfa
     , safe >=0.2
     , split >=0.1 && <0.3
@@ -146,7 +146,7 @@
       Hledger.Cli.Accounts
       Hledger.Cli.Balance
       Hledger.Cli.Balancesheet
-      Hledger.Cli.BalanceView
+      Hledger.Cli.CompoundBalanceCommand
       Hledger.Cli.Cashflow
       Hledger.Cli.Help
       Hledger.Cli.Histogram
@@ -166,7 +166,7 @@
   hs-source-dirs:
       app
   ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans
-  cpp-options: -DVERSION="1.3"
+  cpp-options: -DVERSION="1.3.1"
   build-depends:
       base >=4.8 && <5
     , base-compat >=0.8.1
@@ -179,8 +179,8 @@
     , process
     , temporary
     , tabular >=0.2 && <0.3
-    , hledger-lib >= 1.3
-    , hledger == 1.3
+    , hledger-lib >= 1.3.1
+    , hledger
     , bytestring
     , containers
     , unordered-containers
@@ -229,7 +229,7 @@
   hs-source-dirs:
       test
   ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans
-  cpp-options: -DVERSION="1.3"
+  cpp-options: -DVERSION="1.3.1"
   build-depends:
       base >=4.8 && <5
     , base-compat >=0.8.1
@@ -242,8 +242,8 @@
     , process
     , temporary
     , tabular >=0.2 && <0.3
-    , hledger-lib >= 1.3
-    , hledger == 1.3
+    , hledger-lib >= 1.3.1
+    , hledger
     , bytestring
     , containers
     , unordered-containers
@@ -304,8 +304,8 @@
     , process
     , temporary
     , tabular >=0.2 && <0.3
-    , hledger-lib >= 1.3
-    , hledger == 1.3
+    , hledger-lib >= 1.3.1
+    , hledger
     , criterion
     , html
     , timeit
