Pages
The page() method allows the report output to be presented as printable pages. Use the paginate() option to show the output in a print preview style and the size() and orientation() methods to set the desired page size and orientation. The margins can also be set and whether the report title should be shown on hte the first page only, all pages or not at all.
Headers and footers can be placed at the top and bottom of each page which allows for images, page numbers, current time, column values to be shown.
Page Formatting
Usage:
\Reportico\Engine\Builder\build()
->page()
->leftmargin(value :Margin size in CSS value 10px,2cm)
->rightmargin(value :Margin size in CSS value 10px,2cm)
->topmargin(value :Margin size in CSS value 10px,2cm)
->bottommargin(value :Margin size in CSS value 10px,2cm)
->orientation(type [Portrait|Landscape|portrait|landscape])
->pagetitledisplay(type [Off|TopOfFirstPage|TopOfAllPages])
->formLayout()
->paginate()
->size(type [A5|A4|A3|US-Letter|US-Ledger])
->header(
header text :A block of text which can contain column values using the {} notation,
header style :A CSS string or array of CSS style pairs indicating how to style and position the header)
->footer(
footer text :A block of text which can contain column values using the {} notation,
footer style :A CSS string or array of CSS style pairs indicating how to style and position the footer)
The page() method allows the report output to be presented as printable pages. Use the paginate() option to show the output in a print preview style and the size() and orientation() methods to set the desired page size and orientation. The margins can also be set and whether the report title should be shown on hte the first page only, all pages or not at all.
Headers and footers can be placed at the top and bottom of each page which allows for images, page numbers, current time, column values to be shown.
Run Demo
<?php
require_once(__DIR__ .'/../vendor/autoload.php');
\Reportico\Engine\Builder::build()
->properties([ "bootstrap_preloaded" => true])
->datasource()->database("mysql:host=localhost; dbname=DATABASE NAME")->user("USER")->password("PASSWORD")
->title ("Product Stock")
->description ("Produces a list of our employees")
->sql ("
SELECT ProductID id, ProductName product, UnitsInStock in_stock, UnitsOnOrder on_order, companyname Company, country, categoryname category
FROM northwind_products
join northwind_suppliers on northwind_products.supplierid = northwind_suppliers.supplierid
join northwind_categories on northwind_products.categoryid = northwind_categories.categoryid
WHERE 1 = 1
ORDER BY categoryname
")
->group("category")
->header("category")
->throwPageBefore()
->page()
->paginate()
->pagetitledisplay("Off")
->header("{REPORT_TITLE}", "border-width: 0px 0px 1px 0px; margin: 25px 0px 0px 0px; border-color: #000000; font-size: 18; border-style: solid;padding:0px 0px 0px 0px; width: 100%; background-color: inherit; color: #000; margin-left: 0%;margin-bottom: 70px;text-align:center")
->header( "", "width: 100; height: 50; margin: 5px 0 0 0; background-image:../assets/images/reportico100.png" )
->footer( 'Page: {PAGE} of {PAGETOTAL}', 'border-width: 1 0 0 0; top: 0px; font-size: 8pt; margin: 2px 0px 0px 0px; font-style: italic; margin-top: 30px;' )
->footer( 'Time: date(\'Y-m-d H:i:s\')', 'font-size: 8pt; text-align: right; font-style: italic; width: 100%; margin-top: 30px;' )
->execute();
?>