hledger/hledger/Hledger/Cli/Commands/Balancesheet.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

63 lines
1.7 KiB
Haskell

{-# LANGUAGE QuasiQuotes, RecordWildCards #-}
{-|
The @balancesheet@ command prints a simple balance sheet.
-}
module Hledger.Cli.Commands.Balancesheet (
balancesheetmode
,balancesheet
,tests_Hledger_Cli_Commands_Balancesheet
) where
import Data.String.Here
import System.Console.CmdArgs.Explicit
import Test.HUnit
import Hledger
import Hledger.Cli.CliOptions
import Hledger.Cli.CompoundBalanceCommand
balancesheetSpec = CompoundBalanceCommandSpec {
cbcname = "balancesheet",
cbcaliases = ["bs"],
cbchelp = [here|
This command displays a simple balance sheet, showing historical ending
balances of asset and liability accounts (ignoring any report begin date).
It assumes that these accounts are under a top-level `asset` or `liability`
account (case insensitive, 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",
cbcqueries = [
CBCSubreportSpec{
cbcsubreporttitle="Assets"
,cbcsubreportquery=journalAssetAccountQuery
,cbcsubreportnormalsign=NormallyPositive
,cbcsubreportincreasestotal=True
}
,CBCSubreportSpec{
cbcsubreporttitle="Liabilities"
,cbcsubreportquery=journalLiabilityAccountQuery
,cbcsubreportnormalsign=NormallyNegative
,cbcsubreportincreasestotal=False
}
],
cbctype = HistoricalBalance
}
balancesheetmode :: Mode RawOpts
balancesheetmode = compoundBalanceCommandMode balancesheetSpec
balancesheet :: CliOpts -> Journal -> IO ()
balancesheet = compoundBalanceCommand balancesheetSpec
tests_Hledger_Cli_Commands_Balancesheet :: Test
tests_Hledger_Cli_Commands_Balancesheet = TestList
[
]