{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}
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 DisplayName]
-> BalanceType
-> CompoundBalanceCommandSpec
CompoundBalanceCommandSpec {
cbcdoc :: CommandDoc
cbcdoc = $(embedFileRelative "Hledger/Cli/Commands/Cashflow.txt"),
cbctitle :: CommandDoc
cbctitle = CommandDoc
"Cashflow Statement",
cbcqueries :: [CBCSubreportSpec DisplayName]
cbcqueries = [
CBCSubreportSpec :: forall a.
Text
-> (Journal -> Query)
-> (ReportOpts -> ReportOpts)
-> (PeriodicReport DisplayName MixedAmount
-> PeriodicReport a MixedAmount)
-> Bool
-> CBCSubreportSpec a
CBCSubreportSpec{
cbcsubreporttitle :: Text
cbcsubreporttitle=Text
"Cash flows"
,cbcsubreportquery :: Journal -> Query
cbcsubreportquery=Journal -> Query
journalCashAccountQuery
,cbcsubreportoptions :: ReportOpts -> ReportOpts
cbcsubreportoptions=(\ReportOpts
ropts -> ReportOpts
ropts{normalbalance_ :: Maybe NormalSign
normalbalance_= NormalSign -> Maybe NormalSign
forall a. a -> Maybe a
Just NormalSign
NormallyPositive})
,cbcsubreporttransform :: PeriodicReport DisplayName MixedAmount
-> PeriodicReport DisplayName MixedAmount
cbcsubreporttransform=PeriodicReport DisplayName MixedAmount
-> PeriodicReport DisplayName MixedAmount
forall a. a -> a
id
,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