hledger/hledger/Hledger/Cli/Commands/Balancesheetequity.hs
Simon Michael 9bd1772ea8 bs/bse/cf/is: remove NoCPP pragma
This was added in 2012, I guess to prevent CPP breaking on some
needed and I don't want to do this everywhere; we'll just remember
to not put CPP-like content in quasi-quoted blocks.
2018-08-02 08:25:49 +01:00

61 lines
1.9 KiB
Haskell

{-# LANGUAGE QuasiQuotes, RecordWildCards #-}
{-|
The @balancesheetequity@ command prints a simple balance sheet.
-}
module Hledger.Cli.Commands.Balancesheetequity (
balancesheetequitymode
,balancesheetequity
) where
import Data.String.Here
import System.Console.CmdArgs.Explicit
import Hledger
import Hledger.Cli.CliOptions
import Hledger.Cli.CompoundBalanceCommand
balancesheetequitySpec = CompoundBalanceCommandSpec {
cbcname = "balancesheetequity",
cbcaliases = ["bse"],
cbchelp = [here|This command displays a simple balance sheet, showing historical ending
balances of asset, liability and equity accounts (ignoring any report begin date).
It assumes that these accounts are under a top-level `asset`, `liability` and `equity`
account (plural forms also allowed).
Note this report shows all account balances with normal positive sign
(like conventional financial statements, unlike balance/print/register)
(experimental).
|],
cbctitle = "Balance Sheet With Equity",
cbcqueries = [
CBCSubreportSpec{
cbcsubreporttitle="Assets"
,cbcsubreportquery=journalAssetAccountQuery
,cbcsubreportnormalsign=NormallyPositive
,cbcsubreportincreasestotal=True
}
,CBCSubreportSpec{
cbcsubreporttitle="Liabilities"
,cbcsubreportquery=journalLiabilityAccountQuery
,cbcsubreportnormalsign=NormallyNegative
,cbcsubreportincreasestotal=False
}
,CBCSubreportSpec{
cbcsubreporttitle="Equity"
,cbcsubreportquery=journalEquityAccountQuery
,cbcsubreportnormalsign=NormallyNegative
,cbcsubreportincreasestotal=False
}
],
cbctype = HistoricalBalance
}
balancesheetequitymode :: Mode RawOpts
balancesheetequitymode = compoundBalanceCommandMode balancesheetequitySpec
balancesheetequity :: CliOpts -> Journal -> IO ()
balancesheetequity = compoundBalanceCommand balancesheetequitySpec