hledger-lib-0.23: Core data types, parsers and utilities for the hledger accounting tool.

Safe HaskellNone




A Posting represents a change (by some MixedAmount) of the balance in some Account. Each Transaction contains two or more postings which should add up to 0. Postings reference their parent transaction, so we can look up the date or description there.




postingCleared :: Posting -> BoolSource

Is this posting cleared? If this posting was individually marked as cleared, returns True. Otherwise, return the parent transaction's cleared status or, if there is no parent transaction, return False.

postingAllTags :: Posting -> [Tag]Source

Tags for this posting including any inherited from its parent transaction.

transactionAllTags :: Transaction -> [Tag]Source

Tags for this transaction including any from its postings.

date operations

postingDate :: Posting -> DaySource

Get a posting's (primary) date - it's own primary date if specified, otherwise the parent transaction's primary date, or the null date if there is no parent transaction.

postingDate2 :: Posting -> DaySource

Get a posting's secondary (secondary) date, which is the first of: posting's secondary date, transaction's secondary date, posting's primary date, transaction's primary date, or the null date if there is no parent transaction.

isPostingInDateSpan :: DateSpan -> Posting -> BoolSource

Does this posting fall within the given date span ?

postingsDateSpan :: [Posting] -> DateSpanSource

Get the minimal date span which contains all the postings, or the null date span if there are none.

account name operations

joinAccountNames :: AccountName -> AccountName -> AccountNameSource

Prefix one account name to another, preserving posting type indicators like concatAccountNames.

concatAccountNames :: [AccountName] -> AccountNameSource

Join account names into one. If any of them has () or [] posting type indicators, these (the first type encountered) will also be applied to the resulting account name.

accountNameApplyAliases :: [(AccountName, AccountName)] -> AccountName -> AccountNameSource

Rewrite an account name using the first applicable alias from the given list, if any.