{-# LANGUAGE QuasiQuotes, TemplateHaskell, OverloadedStrings #-}
module Hledger.Cli.Commands.Incomestatement (
incomestatementmode
,incomestatement
) where
import System.Console.CmdArgs.Explicit
import Hledger
import Hledger.Cli.CliOptions
import Hledger.Cli.CompoundBalanceCommand
incomestatementSpec :: CompoundBalanceCommandSpec
incomestatementSpec = CompoundBalanceCommandSpec :: CommandDoc
-> CommandDoc
-> [CBCSubreportSpec DisplayName]
-> BalanceType
-> CompoundBalanceCommandSpec
CompoundBalanceCommandSpec {
cbcdoc :: CommandDoc
cbcdoc = $(embedFileRelative "Hledger/Cli/Commands/Incomestatement.txt"),
cbctitle :: CommandDoc
cbctitle = CommandDoc
"Income 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
"Revenues"
,cbcsubreportquery :: Journal -> Query
cbcsubreportquery=Journal -> Query
journalRevenueAccountQuery
,cbcsubreportoptions :: ReportOpts -> ReportOpts
cbcsubreportoptions=(\ReportOpts
ropts -> ReportOpts
ropts{normalbalance_ :: Maybe NormalSign
normalbalance_=NormalSign -> Maybe NormalSign
forall a. a -> Maybe a
Just NormalSign
NormallyNegative})
,cbcsubreporttransform :: PeriodicReport DisplayName MixedAmount
-> PeriodicReport DisplayName MixedAmount
cbcsubreporttransform=(MixedAmount -> MixedAmount)
-> PeriodicReport DisplayName MixedAmount
-> PeriodicReport DisplayName MixedAmount
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap MixedAmount -> MixedAmount
maNegate
,cbcsubreportincreasestotal :: Bool
cbcsubreportincreasestotal=Bool
True
}
,CBCSubreportSpec :: forall a.
Text
-> (Journal -> Query)
-> (ReportOpts -> ReportOpts)
-> (PeriodicReport DisplayName MixedAmount
-> PeriodicReport a MixedAmount)
-> Bool
-> CBCSubreportSpec a
CBCSubreportSpec{
cbcsubreporttitle :: Text
cbcsubreporttitle=Text
"Expenses"
,cbcsubreportquery :: Journal -> Query
cbcsubreportquery=Journal -> Query
journalExpenseAccountQuery
,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
False
}
],
cbctype :: BalanceType
cbctype = BalanceType
PeriodChange
}
incomestatementmode :: Mode RawOpts
incomestatementmode :: Mode RawOpts
incomestatementmode = CompoundBalanceCommandSpec -> Mode RawOpts
compoundBalanceCommandMode CompoundBalanceCommandSpec
incomestatementSpec
incomestatement :: CliOpts -> Journal -> IO ()
incomestatement :: CliOpts -> Journal -> IO ()
incomestatement = CompoundBalanceCommandSpec -> CliOpts -> Journal -> IO ()
compoundBalanceCommand CompoundBalanceCommandSpec
incomestatementSpec