{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}
module Hledger.Cli.Commands.Balancesheetequity (
balancesheetequitymode
,balancesheetequity
,balancesheetequitySpec
) where
import System.Console.CmdArgs.Explicit
import Hledger.Utils.I18n (i18n)
import Hledger
import Hledger.Cli.CliOptions
import Hledger.Cli.CompoundBalanceCommand
balancesheetequitySpec :: CompoundBalanceCommandSpec
balancesheetequitySpec :: CompoundBalanceCommandSpec
balancesheetequitySpec = CompoundBalanceCommandSpec {
cbcdoc :: CommandHelpStr
cbcdoc = $(embedFileRelative "Hledger/Cli/Commands/Balancesheetequity.txt"),
cbctitle :: Interval -> Text
cbctitle = \case
Interval
NoInterval -> Text -> Text
i18n Text
"Balance Sheet With Equity"
Days Int
1 -> Text -> Text
i18n Text
"Daily Balance Sheet With Equity"
Weeks Int
1 -> Text -> Text
i18n Text
"Weekly Balance Sheet With Equity"
Weeks Int
2 -> Text -> Text
i18n Text
"Biweekly Balance Sheet With Equity"
Months Int
1 -> Text -> Text
i18n Text
"Monthly Balance Sheet With Equity"
Months Int
2 -> Text -> Text
i18n Text
"Bimonthly Balance Sheet With Equity"
Months Int
3 -> Text -> Text
i18n Text
"Quarterly Balance Sheet With Equity"
Months Int
6 -> Text -> Text
i18n Text
"Half-yearly Balance Sheet With Equity"
Years Int
1 -> Text -> Text
i18n Text
"Yearly Balance Sheet With Equity"
Years Int
2 -> Text -> Text
i18n Text
"Biennial Balance Sheet With Equity"
Interval
_ -> Text -> Text
i18n Text
"Periodic Balance Sheet With Equity",
cbcqueries :: [CBCSubreportSpec DisplayName]
cbcqueries = [
CBCSubreportSpec{
cbcsubreporttitle :: Text
cbcsubreporttitle=Text -> Text
i18n Text
"Assets"
,cbcsubreportquery :: Query
cbcsubreportquery=[AccountType] -> Query
Type [AccountType
Asset]
,cbcsubreportoptions :: ReportOpts -> ReportOpts
cbcsubreportoptions=(\ReportOpts
ropts -> ReportOpts
ropts{normalbalance_=Just 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
}
,CBCSubreportSpec{
cbcsubreporttitle :: Text
cbcsubreporttitle=Text -> Text
i18n Text
"Liabilities"
,cbcsubreportquery :: Query
cbcsubreportquery=[AccountType] -> Query
Type [AccountType
Liability]
,cbcsubreportoptions :: ReportOpts -> ReportOpts
cbcsubreportoptions=(\ReportOpts
ropts -> ReportOpts
ropts{normalbalance_=Just NormallyNegative})
,cbcsubreporttransform :: PeriodicReport DisplayName MixedAmount
-> PeriodicReport DisplayName MixedAmount
cbcsubreporttransform=(MixedAmount -> MixedAmount)
-> PeriodicReport DisplayName MixedAmount
-> PeriodicReport DisplayName MixedAmount
forall a b.
(a -> b)
-> PeriodicReport DisplayName a -> PeriodicReport DisplayName b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap MixedAmount -> MixedAmount
maNegate
,cbcsubreportincreasestotal :: Bool
cbcsubreportincreasestotal=Bool
False
}
,CBCSubreportSpec{
cbcsubreporttitle :: Text
cbcsubreporttitle=Text -> Text
i18n Text
"Equity"
,cbcsubreportquery :: Query
cbcsubreportquery=[AccountType] -> Query
Type [AccountType
Equity]
,cbcsubreportoptions :: ReportOpts -> ReportOpts
cbcsubreportoptions=(\ReportOpts
ropts -> ReportOpts
ropts{normalbalance_=Just NormallyNegative})
,cbcsubreporttransform :: PeriodicReport DisplayName MixedAmount
-> PeriodicReport DisplayName MixedAmount
cbcsubreporttransform=(MixedAmount -> MixedAmount)
-> PeriodicReport DisplayName MixedAmount
-> PeriodicReport DisplayName MixedAmount
forall a b.
(a -> b)
-> PeriodicReport DisplayName a -> PeriodicReport DisplayName b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap MixedAmount -> MixedAmount
maNegate
,cbcsubreportincreasestotal :: Bool
cbcsubreportincreasestotal=Bool
False
}
],
cbcaccum :: BalanceAccumulation
cbcaccum = BalanceAccumulation
Historical
}
balancesheetequitymode :: Mode RawOpts
balancesheetequitymode :: Mode RawOpts
balancesheetequitymode = CompoundBalanceCommandSpec -> Mode RawOpts
compoundBalanceCommandMode CompoundBalanceCommandSpec
balancesheetequitySpec
balancesheetequity :: CliOpts -> Journal -> IO ()
balancesheetequity :: CliOpts -> Journal -> IO ()
balancesheetequity = CompoundBalanceCommandSpec -> CliOpts -> Journal -> IO ()
compoundBalanceCommand CompoundBalanceCommandSpec
balancesheetequitySpec