hledger-0.2: A ledger-compatible text-based accounting tool.

Ledger.Entry

Description

An Entry represents a regular entry in the ledger file. It normally contains two or more balanced RawTransactions.

Synopsis

Documentation

showEntry :: Entry -> StringSource

Show a ledger entry, formatted for the print command. ledger 2.x's standard format looks like this:

yyyymmdd[ *][ CODE] description.........          [  ; comment...............]
    account name 1.....................  ...$amount1[  ; comment...............]
    account name 2.....................  ..$-amount1[  ; comment...............]

pcodewidth    = no limit -- 10          -- mimicking ledger layout.
pdescwidth    = no limit -- 20          -- I don't remember what these mean,
pacctwidth    = 35 minimum, no maximum  -- they were important at the time.
pamtwidth     = 11
pcommentwidth = no limit -- 22

balanceEntry :: Entry -> EntrySource

Fill in a missing balance in this entry, if we have enough information to do that. Excluding virtual transactions, there should be at most one missing balance. Otherwise, raise an error. The new balance will be converted to cost basis if possible.