phpLens
 home  products examples manual  faq support forum  contact news  login store

More Examples:   View Source:   Reporting Demo with Export to Excel

Free Download

Click on the Excel icon on the top right of the report to export in CSV format.

This demo also shows multi-level titles, grouping by Supplier, and unit averages.

This is a Demo. You can not change anything for security reasons.
Back to Grid     phpLens Settings  Column Settings   Choose   Generate PHP Code   Remove All Settings   ?  
 
Cancel
FieldREORDERLEVEL   Type: int   Change Type
Default Title
Grid Title
Detail Title 2 Fields in Row
Filter Title

Power Lens
Lookup Values
Overlib Text
Grid TD Attributes   (nowrap, width=30%, align=center etc.)
Cell Color grid^title^input  
Color Reference opens in a new window

Visible in GridYes   Grid Columns

Charting
Chart ImagesGIF/JPEG file:
Image for negative values (only for bar chart):
Chart DimensionsWidth:   Height:
Chart Min/Max (SQL)SQL to get Min/Max field values:
Example SQL: select min(REORDERLEVEL),max(REORDERLEVEL) from products
Chart Min/Max (manual)Minimum field value:   Maximum field value:
Use manual entry if Chart Min/Max (SQL) left empty
Icon Chart ScaleOne icon/character represents unit(s)
  Cancel
PHPLens: 4.9.2   Data: 0.02   DB: mysql   adodb: 4.62   Compat: 2   PHP: 5.2.17   OS: Linux
License Type: Enterprise   ID: (Natsoft;John Lim;jlim@natsoft.com)   Valid Till: Never Expires

Notes

This demo shows how to produce a complex report.

We use the groupLens property to group records by supplier, and lookupLens property to map the supplier id to the actual supplier company name.

We use the avgLens property to calculate averages for the above columns, and set the appropriate captions by modifying the txtTotal and txtSubTotal properties. We use the topCaption property to set it to "Product Report".

Export to Excel

We also support exporting to Excel since phpLens 2.2. We can export both in Excel 5 binary format or CSV. This requires a directory to be defined with the imageTmpDir property to store the temporary CSV or Excel format file.

The columns to be exported are defined by the exportLens property.

Note the ob_start() at the beginning of the code (click View Source). This allows us to perform a HTTP redirect, so the export file will automatically download.

TitleLevels and ColorLevels

We use the titleLevel1, titleLevel2 and titleColor properties to display more complex report headers. For example:

$lens->titleLevel2 = 'ProductName^3^^palegoldenrod;UnitsInStock^1^{NBSP} In Stock {NBSP}^peachpuff;UnitsOnOrder^2^On Order^bisque';

This means, starting from ProductName, create a column that spans 3 cols, followed by a column starting from UnitsInStock called "In Stock" colored peachpuff, and lastly a column starting from UnitsOnOrder spanning 2 cols, named Ordering with the color bisque. {NBSP} will be replaced with   (non-breaking space).

If you require an additional row of title headers, you can also define this row with the titleLevel3 property.

email: contact#phplens.com (change # to @)     telephone (malaysia): 60-3-7947 2888     fax (malaysia): 60-3-7947 2800