* factored out multi-column balance reporting into table creation and string rendering * preliminary multicolumn balance reporting for BalanceView * added -T and -A options for balance views * support for overriding balanceview defaults * fixed unecessary whitespace stripping to make tree view work * no need for ViewPatterns in BalanceView * fixed regression where balancesheet didn't ignore the start date when in single column mode * removed trailing whitespace to pass tests * handling warnings in Balance.hs * force -E to line up lines for bs/is/cf
		
			
				
	
	
		
			42 lines
		
	
	
		
			995 B
		
	
	
	
		
			Haskell
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			995 B
		
	
	
	
		
			Haskell
		
	
	
	
	
	
| {-# LANGUAGE QuasiQuotes, RecordWildCards, NoCPP #-}
 | |
| {-|
 | |
| 
 | |
| The @balancesheet@ command prints a simple balance sheet.
 | |
| 
 | |
| -}
 | |
| 
 | |
| module Hledger.Cli.Balancesheet (
 | |
|   balancesheetmode
 | |
|  ,balancesheet
 | |
|  ,tests_Hledger_Cli_Balancesheet
 | |
| ) where
 | |
| 
 | |
| import System.Console.CmdArgs.Explicit
 | |
| import Test.HUnit
 | |
| 
 | |
| import Hledger
 | |
| import Hledger.Cli.CliOptions
 | |
| import Hledger.Cli.BalanceView
 | |
| 
 | |
| bsBV = BalanceView {
 | |
|          bvmode     = "balancesheet",
 | |
|          bvaliases  = ["bs"],
 | |
|          bvhelp     = "show a balance sheet",
 | |
|          bvtitle    = "Balance Sheet",
 | |
|          bvqueries  = [ ("Assets"     , journalAssetAccountQuery),
 | |
|                         ("Liabilities", journalLiabilityAccountQuery)
 | |
|                       ],
 | |
|          bvtype     = HistoricalBalance
 | |
|       }
 | |
| 
 | |
| balancesheetmode :: Mode RawOpts
 | |
| balancesheetmode = balanceviewmode bsBV
 | |
| 
 | |
| balancesheet :: CliOpts -> Journal -> IO ()
 | |
| balancesheet = balanceviewReport bsBV
 | |
| 
 | |
| tests_Hledger_Cli_Balancesheet :: Test
 | |
| tests_Hledger_Cli_Balancesheet = TestList
 | |
|  [
 | |
|  ]
 |