ReportType -> BalanceCalculation ChangeReport -> CalcChange BudgetReport -> CalcBudget ValueChangeReport -> CalcValueChange BalanceType -> BalanceAccumulation PeriodChange -> PerPeriod CumulativeChange -> Cumulative HistoricalBalance -> Historical ReportOpts: reporttype_ -> balancecalc_ balancetype_ -> balanceaccum_ CompoundBalanceCommandSpec: cbctype -> cbcaccum Hledger.Reports.ReportOptions: balanceTypeOverride -> balanceAccumulationOverride
56 lines
1.7 KiB
Haskell
56 lines
1.7 KiB
Haskell
{-# LANGUAGE OverloadedStrings #-}
|
|
{-# LANGUAGE QuasiQuotes #-}
|
|
{-# LANGUAGE RecordWildCards #-}
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
{-|
|
|
|
|
The @balancesheetequity@ command prints a simple balance sheet.
|
|
|
|
-}
|
|
|
|
module Hledger.Cli.Commands.Balancesheetequity (
|
|
balancesheetequitymode
|
|
,balancesheetequity
|
|
) where
|
|
|
|
import System.Console.CmdArgs.Explicit
|
|
|
|
import Hledger
|
|
import Hledger.Cli.CliOptions
|
|
import Hledger.Cli.CompoundBalanceCommand
|
|
|
|
balancesheetequitySpec = CompoundBalanceCommandSpec {
|
|
cbcdoc = $(embedFileRelative "Hledger/Cli/Commands/Balancesheetequity.txt"),
|
|
cbctitle = "Balance Sheet With Equity",
|
|
cbcqueries = [
|
|
CBCSubreportSpec{
|
|
cbcsubreporttitle="Assets"
|
|
,cbcsubreportquery=journalAssetAccountQuery
|
|
,cbcsubreportoptions=(\ropts -> ropts{normalbalance_=Just NormallyPositive})
|
|
,cbcsubreporttransform=id
|
|
,cbcsubreportincreasestotal=True
|
|
}
|
|
,CBCSubreportSpec{
|
|
cbcsubreporttitle="Liabilities"
|
|
,cbcsubreportquery=journalLiabilityAccountQuery
|
|
,cbcsubreportoptions=(\ropts -> ropts{normalbalance_=Just NormallyNegative})
|
|
,cbcsubreporttransform=fmap maNegate
|
|
,cbcsubreportincreasestotal=False
|
|
}
|
|
,CBCSubreportSpec{
|
|
cbcsubreporttitle="Equity"
|
|
,cbcsubreportquery=journalEquityAccountQuery
|
|
,cbcsubreportoptions=(\ropts -> ropts{normalbalance_=Just NormallyNegative})
|
|
,cbcsubreporttransform=fmap maNegate
|
|
,cbcsubreportincreasestotal=False
|
|
}
|
|
],
|
|
cbcaccum = Historical
|
|
}
|
|
|
|
balancesheetequitymode :: Mode RawOpts
|
|
balancesheetequitymode = compoundBalanceCommandMode balancesheetequitySpec
|
|
|
|
balancesheetequity :: CliOpts -> Journal -> IO ()
|
|
balancesheetequity = compoundBalanceCommand balancesheetequitySpec
|