hledger/hledger/Hledger/Cli/Commands/Cashflow.hs
Stephen Morgan c966a0f413 fix!: cbr: Remove old account type query code. (#1921)
This replaces the old journal*AccountQuery with the new Type query. This
enables uniform treatment of account type, and fixes a subtle bug
(#1921).

Note that cbcsubreportquery no longer takes Journal as an argument.
2022-08-21 08:27:51 +01:00

45 lines
1.2 KiB
Haskell

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE 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 {
cbcdoc = $(embedFileRelative "Hledger/Cli/Commands/Cashflow.txt"),
cbctitle = "Cashflow Statement",
cbcqueries = [
CBCSubreportSpec{
cbcsubreporttitle="Cash flows"
,cbcsubreportquery=Type [Cash]
,cbcsubreportoptions=(\ropts -> ropts{normalbalance_= Just NormallyPositive})
,cbcsubreporttransform=id
,cbcsubreportincreasestotal=True
}
],
cbcaccum = PerPeriod
}
cashflowmode :: Mode RawOpts
cashflowmode = compoundBalanceCommandMode cashflowSpec
cashflow :: CliOpts -> Journal -> IO ()
cashflow = compoundBalanceCommand cashflowSpec