Kaare Rasmussen > Business-ReportWriter > Business::ReportWriter

Download:
Business-ReportWriter-0.09.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Business::ReportWriter - A Business Oriented ReportWriter.

SYNOPSIS ^

  use Business::ReportWriter::Pdf;

  my $rw = new Business::ReportWriter::Pdf();
  $rw->process_report($outfile, $report, $head, $list);

DESCRIPTION ^

Business::ReportWriter is a tool to make a Business Report from an array of data. The report output is generated based on a XML description of the report.

The report is written to a file.

Method calls

$obj = new()

Creates a Report Writer Object.

$obj->process_report($outfile, $report, $head, $list)

Creates a PDF Report and writes it to the file named in $outfile.

$report is a hash reference to the Report Definition. $head is a hash containing external data (also called Page Data). $list is a reference to the array that contains the report data.

Data Description

report

A hash reference describing the wanted output. Contains these sections:

report

Hash with report wide information. Possible entries:

locale - eg us_EN, da_DK...

papersize - A4, Letter...

breaks

A hash defining the line breaks / report totals. Hash key is the name of the field to totl, pointing to a new hash containing

order Sort order of break, starting from 0. Must be unique.

font Font used for the break line. Font is a hash containing face and size.

format printf-like format string.

text Print text for the total line. Any word beginning with a $ character will be replaced with the corresponding field name.

xpos Horisontal position of the text.

total Array telling which fields are to be totalled.

There are two special break names:

_page will result in a total for each page and _total will give a grand total at the end of the report.

fields

Array of hashes describing all fields in the body area of the report. Each element can contain

font Same as in the breaks section.

name Field name - corresponds to the hash in the Data List.

text Same as in the breaks section.

xpos Same as in the breaks section.

align Alignment of field. Possible values are left, center, right.

format Same as in the breaks section.

function A perl function to replace the field as output. Any word beginning with a $ character will be replaced by a field.

depends A perl expression. If true, the field will be printed, if false it will not. Any word beginning with a $ character will be replaced by a field.

page

Hash describing the report outside the body area. Entries are

header - a hash describing the header. There can be a font entry and then there's an array containing text elements, each of which can contain depends, function, text, align, xpos and ypos. These elements do what you'd expect them to. sameline will allow you to skip xpos and let it inherit ypos from the previous entry- very useful if there is a depends entry.

logo Telling where to find the logo and where to place it.

Contains a hash with key logo including an array with image descriptions. Name is the file name including path information, x an y gives upper left corner and scale indicates which factor to scale the image with.

body

A hash describing the body area (where the report list will go). Contains

font (well known by now), ypos telling upper edge of the body and heigth

graphics

A hash entry with key width telling line width and a hash with key boxes containing an array describing ``line graphics'' or boxes. Each box is defined with the values topx, topy, bottomx and bottomy.

Page Data

A hash reference to data that can be used in the page region of the report. pagenr is automatically included and updated.

List Data

Array of hash. Each array element represents one line in the final report. The hash keys can be referenced in the report definition.

SEE ALSO ^

 Business::ReportWriter::OOCalc, Business::ReportWriter::Pdf 

COPYRIGHT ^

Copyright (C) 2003-2006 Kaare Rasmussen. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR ^

Kaare Rasmussen <kar at jasonic.dk>

syntax highlighting: