Debian Codegraph @

Hledger/Cli/Commands/Balancesheetequity.hs

raw
1 {-# LANGUAGE OverloadedStrings #-}
2 {-# LANGUAGE QuasiQuotes #-}
3 {-# LANGUAGE RecordWildCards #-}
4 {-# LANGUAGE TemplateHaskell #-}
5 {-|
6
7 The @balancesheetequity@ command prints a simple balance sheet.
8
9 -}
10
11 module Hledger.Cli.Commands.Balancesheetequity (
12 balancesheetequitymode
13 ,balancesheetequity
14 ) where
15
16 import System.Console.CmdArgs.Explicit
17
18 import Hledger
19 import Hledger.Cli.CliOptions
20 import Hledger.Cli.CompoundBalanceCommand
21
22 balancesheetequitySpec = CompoundBalanceCommandSpec {
23 cbcdoc = $(embedFileRelative "Hledger/Cli/Commands/Balancesheetequity.txt"),
24 cbctitle = "Balance Sheet With Equity",
25 cbcqueries = [
26 CBCSubreportSpec{
27 cbcsubreporttitle="Assets"
28 ,cbcsubreportquery=Type [Asset]
29 ,cbcsubreportoptions=(\ropts -> ropts{normalbalance_=Just NormallyPositive})
30 ,cbcsubreporttransform=id
31 ,cbcsubreportincreasestotal=True
32 }
33 ,CBCSubreportSpec{
34 cbcsubreporttitle="Liabilities"
35 ,cbcsubreportquery=Type [Liability]
36 ,cbcsubreportoptions=(\ropts -> ropts{normalbalance_=Just NormallyNegative})
37 ,cbcsubreporttransform=fmap maNegate
38 ,cbcsubreportincreasestotal=False
39 }
40 ,CBCSubreportSpec{
41 cbcsubreporttitle="Equity"
42 ,cbcsubreportquery=Type [Equity]
43 ,cbcsubreportoptions=(\ropts -> ropts{normalbalance_=Just NormallyNegative})
44 ,cbcsubreporttransform=fmap maNegate
45 ,cbcsubreportincreasestotal=False
46 }
47 ],
48 cbcaccum = Historical
49 }
50
51 balancesheetequitymode :: Mode RawOpts
52 balancesheetequitymode = compoundBalanceCommandMode balancesheetequitySpec
53
54 balancesheetequity :: CliOpts -> Journal -> IO ()
55 balancesheetequity = compoundBalanceCommand balancesheetequitySpec