Implemented the new Cli command 'balancesheetequity`.
This new command shows the same information as balancesheet but also includes the Equity accounts (equity:<account name>).
This commit is contained in:
parent
b246d0e990
commit
5e3c8aaaff
@ -14,6 +14,7 @@ module Hledger.Cli (
|
||||
module Hledger.Cli.Add,
|
||||
module Hledger.Cli.Balance,
|
||||
module Hledger.Cli.Balancesheet,
|
||||
module Hledger.Cli.Balancesheetequity,
|
||||
module Hledger.Cli.Cashflow,
|
||||
module Hledger.Cli.Help,
|
||||
module Hledger.Cli.Histogram,
|
||||
@ -44,6 +45,7 @@ import Hledger.Cli.Accounts
|
||||
import Hledger.Cli.Add
|
||||
import Hledger.Cli.Balance
|
||||
import Hledger.Cli.Balancesheet
|
||||
import Hledger.Cli.Balancesheetequity
|
||||
import Hledger.Cli.Cashflow
|
||||
import Hledger.Cli.Histogram
|
||||
import Hledger.Cli.Help
|
||||
|
||||
40
hledger/Hledger/Cli/Balancesheetequity.hs
Normal file
40
hledger/Hledger/Cli/Balancesheetequity.hs
Normal file
@ -0,0 +1,40 @@
|
||||
{-# LANGUAGE QuasiQuotes, RecordWildCards, NoCPP #-}
|
||||
{-|
|
||||
|
||||
The @balancesheetequity@ command prints a simple balance sheet.
|
||||
|
||||
-}
|
||||
|
||||
module Hledger.Cli.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).
|
||||
|],
|
||||
cbctitle = "Balance Sheet With Equity",
|
||||
cbcqueries = [ ("Assets" , journalAssetAccountQuery),
|
||||
("Liabilities", journalLiabilityAccountQuery),
|
||||
("Equity", journalEquityAccountQuery)
|
||||
],
|
||||
cbctype = HistoricalBalance
|
||||
}
|
||||
|
||||
balancesheetequitymode :: Mode RawOpts
|
||||
balancesheetequitymode = compoundBalanceCommandMode balancesheetequitySpec
|
||||
|
||||
balancesheetequity :: CliOpts -> Journal -> IO ()
|
||||
balancesheetequity = compoundBalanceCommand balancesheetequitySpec
|
||||
@ -58,6 +58,7 @@ import Hledger.Cli.Add
|
||||
import Hledger.Cli.Accounts
|
||||
import Hledger.Cli.Balance
|
||||
import Hledger.Cli.Balancesheet
|
||||
import Hledger.Cli.Balancesheetequity
|
||||
import Hledger.Cli.Cashflow
|
||||
import Hledger.Cli.Help
|
||||
import Hledger.Cli.Histogram
|
||||
@ -97,6 +98,7 @@ mainmode addons = defMode {
|
||||
,addmode
|
||||
,balancemode
|
||||
,balancesheetmode
|
||||
,balancesheetequitymode
|
||||
,cashflowmode
|
||||
,helpmode
|
||||
,incomestatementmode
|
||||
@ -224,6 +226,7 @@ commandsListTemplate = [here|Commands available (COUNT):
|
||||
Standard reports:
|
||||
accounts show chart of accounts
|
||||
balancesheet (bs) show a balance sheet
|
||||
balancesheetequity (bse) show a balance sheet with equity
|
||||
cashflow (cf) show a cashflow statement
|
||||
incomestatement (is) show an income statement
|
||||
transactions (txns) show transactions in some account
|
||||
@ -376,6 +379,7 @@ main = do
|
||||
| cmd == "accounts" = withJournalDo opts accounts `orShowHelp` accountsmode
|
||||
| cmd == "balance" = withJournalDo opts balance `orShowHelp` balancemode
|
||||
| cmd == "balancesheet" = withJournalDo opts balancesheet `orShowHelp` balancesheetmode
|
||||
| cmd == "balancesheetequity" = withJournalDo opts balancesheetequity `orShowHelp` balancesheetequitymode
|
||||
| cmd == "cashflow" = withJournalDo opts cashflow `orShowHelp` cashflowmode
|
||||
| cmd == "incomestatement" = withJournalDo opts incomestatement `orShowHelp` incomestatementmode
|
||||
| cmd == "print" = withJournalDo opts print' `orShowHelp` printmode
|
||||
|
||||
@ -126,6 +126,7 @@ library
|
||||
Hledger.Cli.Accounts
|
||||
Hledger.Cli.Balance
|
||||
Hledger.Cli.Balancesheet
|
||||
Hledger.Cli.Balancesheetequity
|
||||
Hledger.Cli.CompoundBalanceCommand
|
||||
Hledger.Cli.Cashflow
|
||||
Hledger.Cli.Help
|
||||
|
||||
@ -107,6 +107,7 @@ library:
|
||||
- Hledger.Cli.Accounts
|
||||
- Hledger.Cli.Balance
|
||||
- Hledger.Cli.Balancesheet
|
||||
- Hledger.Cli.Balancesheetequity
|
||||
- Hledger.Cli.CompoundBalanceCommand
|
||||
- Hledger.Cli.Cashflow
|
||||
- Hledger.Cli.Help
|
||||
|
||||
Loading…
Reference in New Issue
Block a user