penny-lib-0.16.0.0: Extensible double-entry accounting system - library

Safe HaskellNone

Penny.Brenner.Types

Synopsis

Documentation

newtype Date Source

The date reported by the financial institution.

Constructors

Date 

Fields

unDate :: Day
 

data IncDec Source

Reports changes in account balances. Avoids using debit and credit as these terms are used differently by the bank than in your ledger (that is, the bank reports it from their perspective, not yours) so instead the terms increase and decrease are used. IncDec is used to record the bank's transactions so increase and decrease are used in the same way you would see them on a bank statement, whether it's a credit card, loan, checking account, etc.

Constructors

Increase

Increases the account balance. For a checking or savings account, this is a deposit. For a credit card, this is a purchase.

Decrease

Decreases the account balance. On a credit card, this is a payment. On a checking account, this is a withdrawal.

newtype UNumber Source

A unique number assigned by Brenner to identify each posting. This is unique within a particular financial institution account only.

Constructors

UNumber 

Fields

unUNumber :: Integer
 

newtype FitId Source

For Brenner to work, the bank has to assign unique identifiers to each transaction that it gives you for download. This is the easiest reliable way to ensure duplicates are not processed multiple times. (There are other ways to accomplish this, but they are much harder and less reliable.) If the bank does not do this, you can't use Brenner.

Constructors

FitId 

Fields

unFitId :: Text
 

newtype Payee Source

Some financial institutions assign a separate Payee in addition to a description. Others just have a single Description field. If this institution uses both, put something here. Brenner will prefer the Payee if it is not zero length; then it will use the Desc.

Constructors

Payee 

Fields

unPayee :: Text
 

newtype Desc Source

The transaction description. Some institutions assign only a description (sometimes muddling a payee with long codes, some dates, etc). Brenner prefers the Payee if there is one, and uses a Desc otherwise.

Constructors

Desc 

Fields

unDesc :: Text
 

data Amount Source

The amount of the transaction. Do not include any leading plus or minus signs; this should be only digits and a decimal point.

mkAmount :: String -> Maybe AmountSource

Ensures that incoming Amounts have only digits and (up to) one decimal point.

data Posting Source

Constructors

Posting 

Fields

date :: Date
 
desc :: Desc
 
incDec :: IncDec
 
amount :: Amount
 
payee :: Payee
 
fitId :: FitId
 

newtype ConfigLocation Source

Where is a configuration file

Constructors

ConfigLocation 

newtype DbLocation Source

Where is the database of postings?

Constructors

DbLocation 

Fields

unDbLocation :: Text
 

newtype FitAcctName Source

A name used to refer to a batch of settings.

Constructors

FitAcctName 

Fields

unFitAcctName :: Text
 

newtype FitAcctDesc Source

Text description of the financial institution account.

Constructors

FitAcctDesc 

Fields

unFitAcctDesc :: Text
 

newtype ParserDesc Source

Text description of the parser itself.

Constructors

ParserDesc 

Fields

unParserDesc :: Text
 

newtype PennyAcct Source

The Penny account holding postings for this financial institution. For instance it might be Assets:Checking if this is your checking account, Liabilities:Credit Card, or whatever.

Constructors

PennyAcct 

Fields

unPennyAcct :: Account
 

data Translator Source

What the financial institution shows as an increase or decrease has to be recorded as a debit or credit in the PennyAcct.

Constructors

IncreaseIsDebit

That is, when the financial institution shows a posting that increases your account balance, you record a debit. You will probably use this for deposit accounts, like checking and savings. These are asset accounts so if the balance goes up you record a debit in your ledger.

IncreaseIsCredit

That is, when the financial institution shows a posting that increases your account balance, you record a credit. You will probably use this for liabilities, such as credit cards and other loans.

newtype DefaultAcct Source

The default account to place unclassified postings in. For instance Expenses:Unclassified.

Constructors

DefaultAcct 

newtype Currency Source

The currency for all transactions, e.g. $.

Constructors

Currency 

data FitAcct Source

A batch of settings representing a single financial institution account.

Constructors

FitAcct 

Fields

fitAcctName :: FitAcctName
 
fitAcctDesc :: FitAcctDesc
 
dbLocation :: DbLocation
 
pennyAcct :: PennyAcct
 
defaultAcct :: DefaultAcct
 
currency :: Currency
 
groupSpecs :: GroupSpecs
 
translator :: Translator
 
side :: Side

When creating new transactions, the commodity will be on this side

spaceBetween :: SpaceBetween

When creating new transactions, is there a space between the commodity and the quantity

parser :: (ParserDesc, FitFileLocation -> IO (Exceptional String [Posting]))

Parses a file of transactions from the financial institution. The function must open the file and parse it. This is in the IO monad not only because the function must open the file itself, but also so the function can perform arbitrary IO (run pdftotext, maybe?) If there is failure, the function can return an Exceptional String, which is the error message. Alternatively the function can raise an exception in the IO monad (currently Brenner makes no attempt to catch these) so if any of the IO functions throw you can simply not handle the exceptions.

The first element of the pair gives information about the parser.

toLincolnPayee :: Desc -> Payee -> Payee

Sometimes the financial institution provides Payee information, sometimes it does not. Sometimes the Desc might have additional information that you might want to remove. This function can be used to do that. The resulting Lincoln Payee is used for any transactions that are created by the merge command. The resulting payee is also used when comparing new financial institution postings to already existing ledger transactions in order to guess at which payee and accounts to create in the transactions created by the merge command.

data Config Source

Configuration for the Brenner program. You can optionally have a default FitAcct, which is used if you do not specify any FitAcct on the command line. You can also name any number of additional FitAccts. If you do not specify a default FitAcct, you must specify a FitAcct on the command line.

Constructors

Config 

newtype AllowNew Source

Constructors

AllowNew 

Fields

unAllowNew :: Bool
 

Instances

type ParserFn = FitFileLocation -> IO (Exceptional String [Posting])Source

All parsers must be of this type.