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

Safe HaskellNone

Penny.Cabin.Posts

Description

The Penny Postings report

The Postings report displays postings in a tabular format designed to be read by humans. Some terminology used in the Postings report:

row
The smallest unit that spans from left to right. A row, however, might consist of more than one screen line. For example, the running balance is shown on the far right side of the Postings report. The running balance might consist of more than one commodity. Each commodity is displayed on its own screen line. However, all these lines put together are displayed in a single row.
column
The smallest unit that spans from top to bottom.
tranche
Each posting is displayed in several rows. The group of rows that is displayed for a single posting is called a tranche.
tranche row
Each tranche has a particular number of rows (currently four); each of these rows is known as a tranche row.
field
Corresponds to a particular element of the posting, such as whether it is a debit or credit or its payee. The user can select which fields to see.
allocation
The width of the Payee and Account fields is variable. Generally their width will adjust to fill the entire width of the screen. The allocations of the Payee and Account fields determine how much of the remaining space each field will receive.

The Postings report is easily customized from the command line to show various fields. However, the order of the fields is not configurable without editing the source code (sorry).

Synopsis

Documentation

postsReportSource

Arguments

:: Changers 
-> ShowZeroBalances 
-> Pdct (LibertyMeta, Posting)

Removes posts from the report if applying this function to the post returns False. Posts removed still affect the running balance.

-> [PostFilterFn]

Applies these post-filters to the list of posts that results from applying the predicate above. Might remove more postings. Postings removed still affect the running balance.

-> ChunkOpts 
-> [(LibertyMeta, Posting)] 
-> [Chunk] 

All information needed to make a Posts report. This function never fails.

data ZincOpts Source

All the information to configure the postings report if the options will be parsed in from the command line.

Constructors

ZincOpts 

Fields

fields :: Fields Bool

Default fields to show in the report.

width :: ReportWidth

Gives the default report width. This can be overridden on the command line. You can use the information from the Runtime to make this as wide as the current terminal.

showZeroBalances :: ShowZeroBalances

Are commodities that have no balance shown in the Total fields of the report?

dateFormat :: (PostMeta, Posting) -> Text

How to display dates. This function is applied to the a PostingInfo so it has lots of information, but it should return a date for use in the Date field.

qtyFormat :: (PostMeta, Posting) -> Text

How to display the quantity of the posting. This function is applied to a Box so it has lots of information, but it should return a formatted string of the quantity. Allows you to format digit grouping, radix points, perform rounding, etc.

balanceFormat :: Commodity -> Qty -> Text

How to display balance totals. Similar to balanceFormat.

subAccountLength :: SubAccountLength

When shortening the names of sub accounts to make them fit, they will be this long.

payeeAllocation :: Alloc

This and accountAllocation determine how much space payees and accounts receive. They divide up the remaining space after everything else is displayed. For instance if payeeAllocation is 60 and accountAllocation is 40, the payee takes about 60 percent of the remaining space and the account takes about 40 percent.

accountAllocation :: Alloc

See payeeAllocation above

spacers :: Spacers Int

Default width for spacer fields. If any of these Ints are less than or equal to zero, there will be no spacer. There is never a spacer for fields that do not appear in the report.

data Alloc Source

Instances

yearMonthDay :: (PostMeta, Posting) -> TextSource

Shows the date of a posting in YYYY-MM-DD format.

qtyAsIs :: (PostMeta, Posting) -> TextSource

Shows the quantity of a posting. Does no rounding or prettification; simply uses show on the underlying Decimal.

balanceAsIs :: a -> Qty -> TextSource

Shows the quantity of a balance. If there is no quantity, shows two dashes.

defaultWidth :: ReportWidthSource

The default width for the report.

columnsVarToWidth :: Maybe String -> ReportWidthSource

Applied to the value of the COLUMNS environment variable, returns an appropriate ReportWidth.

widthFromRuntime :: Runtime -> ReportWidthSource

Given the Runtime, use the defaultWidth given above to calculate the report's width if COLUMNS does not yield a value. Otherwise, use what is in COLUMNS.

defaultFields :: Fields BoolSource

Default fields to show in the Postings report.

defaultSpacerWidth :: Spacers IntSource

Default width of spacers; most are one character wide, but the spacer after payee is 4 characters wide.