Debian Codegraph @

Hledger/Cli/Commands/Cashflow.hs

raw
1 {-# LANGUAGE OverloadedStrings #-}
2 {-# LANGUAGE QuasiQuotes #-}
3 {-# LANGUAGE RecordWildCards #-}
4 {-# LANGUAGE TemplateHaskell #-}
5 {-|
6
7 The @cashflow@ command prints a simplified cashflow statement. It just
8 shows the change in all "cash" accounts for the period (without the
9 traditional segmentation into operating, investing, and financing
10 cash flows.)
11
12 -}
13
14 module Hledger.Cli.Commands.Cashflow (
15 cashflowmode
16 ,cashflow
17 ) where
18
19 import System.Console.CmdArgs.Explicit
20
21 import Hledger
22 import Hledger.Cli.CliOptions
23 import Hledger.Cli.CompoundBalanceCommand
24
25 cashflowSpec = CompoundBalanceCommandSpec {
26 cbcdoc = $(embedFileRelative "Hledger/Cli/Commands/Cashflow.txt"),
27 cbctitle = "Cashflow Statement",
28 cbcqueries = [
29 CBCSubreportSpec{
30 cbcsubreporttitle="Cash flows"
31 ,cbcsubreportquery=Type [Cash]
32 ,cbcsubreportoptions=(\ropts -> ropts{normalbalance_= Just NormallyPositive})
33 ,cbcsubreporttransform=id
34 ,cbcsubreportincreasestotal=True
35 }
36 ],
37 cbcaccum = PerPeriod
38 }
39
40 cashflowmode :: Mode RawOpts
41 cashflowmode = compoundBalanceCommandMode cashflowSpec
42
43 cashflow :: CliOpts -> Journal -> IO ()
44 cashflow = compoundBalanceCommand cashflowSpec