misc helpers
This commit is contained in:
parent
9ea1f4a98b
commit
77ca58269a
@ -50,6 +50,12 @@ getCurrentDay = do
|
||||
t <- getZonedTime
|
||||
return $ localDay (zonedTimeToLocalTime t)
|
||||
|
||||
-- | Get the current local month number.
|
||||
getCurrentMonth :: IO Int
|
||||
getCurrentMonth = do
|
||||
(_,m,_) <- toGregorian `fmap` getCurrentDay
|
||||
return m
|
||||
|
||||
-- | Get the current local year.
|
||||
getCurrentYear :: IO Integer
|
||||
getCurrentYear = do
|
||||
|
||||
@ -71,6 +71,10 @@ ledgerAccounts = drop 1 . flatten . ledgerAccountTree 9999
|
||||
ledgerTopAccounts :: Ledger -> [Account]
|
||||
ledgerTopAccounts = map root . branches . ledgerAccountTree 9999
|
||||
|
||||
-- | List a ledger's bottom-level (subaccount-less) accounts, in tree order
|
||||
ledgerLeafAccounts :: Ledger -> [Account]
|
||||
ledgerLeafAccounts = leaves . ledgerAccountTree 9999
|
||||
|
||||
-- | Accounts in ledger whose name matches the pattern, in tree order.
|
||||
ledgerAccountsMatching :: [String] -> Ledger -> [Account]
|
||||
ledgerAccountsMatching pats = filter (matchpats pats . aname) . accounts
|
||||
|
||||
@ -42,6 +42,7 @@ module Hledger.Reports (
|
||||
AccountsReportItem,
|
||||
accountsReport,
|
||||
accountsReport2,
|
||||
isInteresting,
|
||||
-- * Tests
|
||||
tests_Hledger_Reports
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user