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

Safe HaskellNone



Calculates cells that grow to fit. These cells grow to fit the widest cell in the column. No information is ever truncated from these cells (what use is a truncated dollar amount?)



data GrowOpts Source

All the options needed to grow the cells.

growCells :: Changers -> GrowOpts -> [(PostMeta, Posting)] -> Fields (Maybe ([ColumnSpec], Int))Source

Grows the cells that will be GrowToFit cells in the report. First this function fills in all visible cells with text, but leaves the width undetermined. Then it determines the widest line in each column. Finally it adjusts each cell in the column so that it is that maximum width.

Returns a list of rows, and a Fields holding the width of each cell. Each of these widths will be at least 1; fields that were in the report but that ended up having no width are changed to Nothing.

data Fields a Source

All growing fields.




globalTransaction :: a
revGlobalTransaction :: a
globalPosting :: a
revGlobalPosting :: a
fileTransaction :: a
revFileTransaction :: a
filePosting :: a
revFilePosting :: a
filtered :: a
revFiltered :: a
sorted :: a
revSorted :: a
visible :: a
revVisible :: a
lineNum :: a

The line number from the posting's metadata

date :: a
flag :: a
number :: a
postingDrCr :: a
postingCmdty :: a
postingQty :: a
totalDrCr :: a
totalCmdty :: a
totalQty :: a

grownWidth :: Fields (Maybe Int) -> Spacers Int -> IntSource

Compute the width of all Grown cells, including any applicable spacer cells.

eFields :: Fields EFieldsSource

Returns a Fields where each record has its corresponding EField.

pairWithSpacer :: Fields a -> Spacers b -> Fields (a, Maybe b)Source

Pairs data from a Fields with its matching spacer field. The spacer field is returned in a Maybe because the TotalQty field does not have a spacer.