small reports cleanups

This commit is contained in:
Simon Michael 2011-08-04 08:26:55 +00:00
parent ce30cb2cbe
commit 63f790b94e
2 changed files with 9 additions and 8 deletions

View File

@ -429,7 +429,7 @@ registerChartHtml items = [$hamlet|
[ [
[ [
$forall i <- items $forall i <- items
[#{dayToJsTimestamp $ ariDate i}, #{ariBalance i}], [#{dayToJsTimestamp $ triDate i}, #{triBalance i}],
] ]
], ],
{ {

View File

@ -21,8 +21,8 @@ module Hledger.Cli.Reports (
-- * Transactions report -- * Transactions report
TransactionsReport, TransactionsReport,
TransactionsReportItem, TransactionsReportItem,
ariDate, triDate,
ariBalance, triBalance,
journalTransactionsReport, journalTransactionsReport,
accountTransactionsReport, accountTransactionsReport,
-- * Accounts report -- * Accounts report
@ -53,8 +53,9 @@ import Hledger.Cli.Utils
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- | A raw journal report is a list of transactions used to generate a raw journal view. -- | A raw journal report is a list of whole transactions used to generate
-- Used by eg hledger's print command. -- a raw journal view. Used by eg hledger's print command and
-- hledger-web's raw journal view.
type RawJournalReport = [RawJournalReportItem] type RawJournalReport = [RawJournalReportItem]
type RawJournalReportItem = Transaction type RawJournalReportItem = Transaction
@ -228,8 +229,8 @@ type TransactionsReportItem = (Transaction -- the corresponding transaction
,MixedAmount -- the running balance for the current account(s) after this transaction ,MixedAmount -- the running balance for the current account(s) after this transaction
) )
ariDate (t,_,_,_,_,_) = tdate t triDate (t,_,_,_,_,_) = tdate t
ariBalance (_,_,_,_,_,Mixed a) = case a of [] -> "0" triBalance (_,_,_,_,_,Mixed a) = case a of [] -> "0"
(Amount{quantity=q}):_ -> show q (Amount{quantity=q}):_ -> show q
-- | Select transactions from the whole journal for a transactions report, -- | Select transactions from the whole journal for a transactions report,
@ -331,7 +332,7 @@ filterTransactionPostings m t@Transaction{tpostings=ps} = t{tpostings=filter (m
-- | An accounts report is a list of account names (full and short -- | An accounts report is a list of account names (full and short
-- variants) with their balances, appropriate indentation for rendering as -- variants) with their balances, appropriate indentation for rendering as
-- a hierarchy tree, and grand total. -- a hierarchy, and grand total.
type AccountsReport = ([AccountsReportItem] -- line items, one per account type AccountsReport = ([AccountsReportItem] -- line items, one per account
,MixedAmount -- total balance of all accounts ,MixedAmount -- total balance of all accounts
) )