    {-# LANGUAGE QuasiQuotes, RecordWildCards #-}
    {-# LANGUAGE TemplateHaskell #-}
    {-|

    The @cashflow@ command prints a simplified cashflow statement.  It just
    shows the change in all "cash" accounts for the period (without the
    traditional segmentation into operating, investing, and financing
    cash flows.)

    -}

    module Hledger.Cli.Commands.Cashflow (
      cashflowmode
     ,cashflow
    ) where

    import System.Console.CmdArgs.Explicit

    import Hledger
    import Hledger.Cli.CliOptions
    import Hledger.Cli.CompoundBalanceCommand

    cashflowSpec :: CompoundBalanceCommandSpec
    cashflowSpec = CompoundBalanceCommandSpec :: CommandDoc
    -> CommandDoc
    -> [CBCSubreportSpec]
    -> BalanceType
    -> CompoundBalanceCommandSpec
    CompoundBalanceCommandSpec {
      cbcdoc :: CommandDoc
    cbcdoc      = $(embedFileRelative "Hledger/Cli/Commands/Cashflow.txt"),
      cbctitle :: CommandDoc
    cbctitle    = "Cashflow Statement",
      cbcqueries :: [CBCSubreportSpec]
    cbcqueries  = [
         CBCSubreportSpec :: CommandDoc
    -> (Journal -> Query) -> NormalSign -> Bool -> CBCSubreportSpec
    CBCSubreportSpec{
          cbcsubreporttitle :: CommandDoc
    cbcsubreporttitle="Cash flows"
         ,cbcsubreportquery :: Journal -> Query
    cbcsubreportquery=Journal -> Query
    journalCashAccountQuery
         ,cbcsubreportnormalsign :: NormalSign
    cbcsubreportnormalsign=NormalSign
    NormallyPositive
         ,cbcsubreportincreasestotal :: Bool
    cbcsubreportincreasestotal=Bool
    True
         }
        ],
      cbctype :: BalanceType
    cbctype     = BalanceType
    PeriodChange
    }

    cashflowmode :: Mode RawOpts
    cashflowmode :: Mode RawOpts
    cashflowmode = CompoundBalanceCommandSpec -> Mode RawOpts
    compoundBalanceCommandMode CompoundBalanceCommandSpec
    cashflowSpec

    cashflow :: CliOpts -> Journal -> IO ()
    cashflow :: CliOpts -> Journal -> IO ()
    cashflow = CompoundBalanceCommandSpec -> CliOpts -> Journal -> IO ()
    compoundBalanceCommand CompoundBalanceCommandSpec
    cashflowSpec