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

Safe HaskellSafe-Infered

Penny.Cabin.Posts.Allocated

Description

Calculates the allocated cells -- the Payee cell and the Account cell. Here is the logic for this process:

  1. If neither Payee nor Account appears, do nothing.
  2. Obtain the width of the growing cells, including the spacers. One of the spacers attached to a field might be omitted:

a. If the rightmost growing field is TotalQty, include all spacers.

b. If the rightmost growing field is to the left of Payee, include all spacers.

c. If the rightmost growing field is to the right of Account but is not TotalQty, omit its spacer.

  1. Subtract from this sum the width of the Payee and Account spacers:

a. Subtract the width of Payee spacer if it appears.

b. Subtract the width of the Account spacer if it appears.

  1. If the remaining width is 0 or less, do nothing. Return, but indicate in return value that neither Payee nor Account is showing.
  2. Allocate the remaining width. If only Payee or Account appears, it gets all the width; otherwise, allocate the widths. No special arrangements are made if either field gets an allocation of 0.
  3. Fill cell contents. Return filled cells.

Synopsis

Documentation

payeeAndAcct :: Fields (Maybe Int) -> T -> [Box] -> Fields (Maybe ([ColumnSpec], Int))Source

Creates Payee and Account cells. The user must have requested the cells. In addition, no cells are created if there is not enough space for them in the report. Returns a Fields; each element of the Fields is Nothing if no cells were created (either because the user did not ask for them, or because there was no room) or Just cs i, where cs is a list of all the cells, and i is the width of all the cells.

data Fields a Source

Constructors

Fields 

Fields

payee :: a
 
account :: a