Safe Haskell | None |
---|
A Journal
is a set of transactions, plus optional related data. This is
hledger's primary data object. It is usually parsed from a journal file or
other data format (see Hledger.Read).
- addHistoricalPrice :: HistoricalPrice -> Journal -> Journal
- addModifierTransaction :: ModifierTransaction -> Journal -> Journal
- addPeriodicTransaction :: PeriodicTransaction -> Journal -> Journal
- addTimeLogEntry :: TimeLogEntry -> Journal -> Journal
- addTransaction :: Transaction -> Journal -> Journal
- journalApplyAliases :: [(AccountName, AccountName)] -> Journal -> Journal
- journalBalanceTransactions :: Journal -> Either String Journal
- journalCanonicaliseAmounts :: Journal -> Journal
- journalConvertAmountsToCost :: Journal -> Journal
- journalFinalise :: ClockTime -> LocalTime -> FilePath -> String -> JournalContext -> Journal -> Either String Journal
- journalSelectingDate :: WhichDate -> Journal -> Journal
- filterJournalPostings :: Query -> Journal -> Journal
- filterJournalTransactions :: Query -> Journal -> Journal
- journalAccountNames :: Journal -> [AccountName]
- journalAccountNamesUsed :: Journal -> [AccountName]
- journalAmountAndPriceCommodities :: Journal -> [Commodity]
- journalAmounts :: Journal -> [MixedAmount]
- journalCanonicalCommodities :: Journal -> Map String Commodity
- journalDateSpan :: Journal -> DateSpan
- journalFilePath :: Journal -> FilePath
- journalFilePaths :: Journal -> [FilePath]
- journalPostings :: Journal -> [Posting]
- journalBalanceSheetAccountQuery :: Journal -> Query
- journalProfitAndLossAccountQuery :: Journal -> Query
- journalIncomeAccountQuery :: Journal -> Query
- journalExpenseAccountQuery :: Journal -> Query
- journalAssetAccountQuery :: Journal -> Query
- journalLiabilityAccountQuery :: Journal -> Query
- journalEquityAccountQuery :: Journal -> Query
- journalCashAccountQuery :: Journal -> Query
- matchpats :: [String] -> String -> Bool
- nullctx :: JournalContext
- nulljournal :: Journal
- samplejournal :: Journal
- tests_Hledger_Data_Journal :: Test
Parsing helpers
addTimeLogEntry :: TimeLogEntry -> Journal -> JournalSource
addTransaction :: Transaction -> Journal -> JournalSource
journalApplyAliases :: [(AccountName, AccountName)] -> Journal -> JournalSource
Apply additional account aliases (eg from the command-line) to all postings in a journal.
journalBalanceTransactions :: Journal -> Either String JournalSource
Fill in any missing amounts and check that all journal transactions balance, or return an error message. This is done after parsing all amounts and working out the canonical commodities, since balancing depends on display precision. Reports only the first error encountered.
journalCanonicaliseAmounts :: Journal -> JournalSource
Convert all the journal's posting amounts (not price amounts) to their canonical display settings. Ie, all amounts in a given commodity will use (a) the display settings of the first, and (b) the greatest precision, of the posting amounts in that commodity.
journalConvertAmountsToCost :: Journal -> JournalSource
Convert all this journal's amounts to cost by applying their prices, if any.
journalFinalise :: ClockTime -> LocalTime -> FilePath -> String -> JournalContext -> Journal -> Either String JournalSource
Do post-parse processing on a journal to make it ready for use: check all transactions balance, canonicalise amount formats, close any open timelog entries and so on.
journalSelectingDate :: WhichDate -> Journal -> JournalSource
Convert this journal's transactions' primary date to either the actual or effective date.
Filtering
filterJournalPostings :: Query -> Journal -> JournalSource
Keep only postings matching the query expression. This can leave unbalanced transactions.
filterJournalTransactions :: Query -> Journal -> JournalSource
Keep only transactions matching the query expression.
Querying
journalAccountNamesUsed :: Journal -> [AccountName]Source
All account names used in this journal.
journalAmountAndPriceCommodities :: Journal -> [Commodity]Source
Get all this journal's amount and price commodities, in the order parsed.
journalAmounts :: Journal -> [MixedAmount]Source
Get all this journal's amounts, in the order parsed.
journalCanonicalCommodities :: Journal -> Map String CommoditySource
Get this journal's unique, display-preference-canonicalised commodities, by symbol.
journalDateSpan :: Journal -> DateSpanSource
The (fully specified) date span containing this journal's transactions, or DateSpan Nothing Nothing if there are none.
journalFilePaths :: Journal -> [FilePath]Source
journalPostings :: Journal -> [Posting]Source
Standard account types
journalBalanceSheetAccountQuery :: Journal -> QuerySource
A query for Asset, Liability & Equity accounts in this journal. Cf http://en.wikipedia.org/wiki/Chart_of_accounts#Balance_Sheet_Accounts.
journalProfitAndLossAccountQuery :: Journal -> QuerySource
A query for Profit & Loss accounts in this journal. Cf http://en.wikipedia.org/wiki/Chart_of_accounts#Profit_.26_Loss_accounts.
journalIncomeAccountQuery :: Journal -> QuerySource
A query for Income (Revenue) accounts in this journal.
This is currently hard-coded to the case-insensitive regex ^(income|revenue)s?(:|$)
.
journalExpenseAccountQuery :: Journal -> QuerySource
A query for Expense accounts in this journal.
This is currently hard-coded to the case-insensitive regex ^expenses?(:|$)
.
journalAssetAccountQuery :: Journal -> QuerySource
A query for Asset accounts in this journal.
This is currently hard-coded to the case-insensitive regex ^assets?(:|$)
.
journalLiabilityAccountQuery :: Journal -> QuerySource
A query for Liability accounts in this journal.
This is currently hard-coded to the case-insensitive regex ^liabilit(y|ies)(:|$)
.
journalEquityAccountQuery :: Journal -> QuerySource
A query for Equity accounts in this journal.
This is currently hard-coded to the case-insensitive regex ^equity(:|$)
.
journalCashAccountQuery :: Journal -> QuerySource
A query for Cash (-equivalent) accounts in this journal (ie,
accounts which appear on the cashflow statement.) This is currently
hard-coded to be all the Asset accounts except for those containing the
case-insensitive regex (receivable|A/R)
.
Misc
matchpats :: [String] -> String -> BoolSource
Check if a set of hledger account/description filter patterns matches the given account name or entry description. Patterns are case-insensitive regular expressions. Prefixed with not:, they become anti-patterns.