PHP Classes

File: demo.php

Recommend this page to a friend!
  Classes of Leonid   PHP Report Designer   demo.php   Download  
File: demo.php
Role: Example script
Content type: text/plain
Description: demo
Class: PHP Report Designer
Display interactive report data from arrays
Author: By
Last change:
Date: 9 years ago
Size: 2,228 bytes
 

Contents

Class file image Download
<?php

/**PHP rep designer Demo
 * @author leonid martynov
 * @copyright 2014
 */

include 'repdesigner.php';


$rd = new RepDesigner();
$rd->cache_on = true;
if(!
$rd->ValidateCache())
    {
   
$sales[] = 'John';
   
$sales[] = 'Dru';
   
$sales[] = 'Colt';
   
$sales[] = 'Harry';
   
$sales[] = 'Mary';

   
$city[] = 'NY';
   
$city[] = 'Paris';
   
$city[] = 'London';
   
$city[] = 'Berlin';
   
$city[] = 'Madrid';

   
$prods[] = 'TV';
   
$prods[] = 'PC';
   
$prods[] = 'Mobile';
   
$prods[] = 'Tablet';
   
$prods[] = 'Notebook';

   
$month[] = 'August';
   
$month[] = 'May';
   
$month[] = 'April';
   
$month[] = 'September';
   
$month[] = 'June';

    for(
$i=0;$i<3000;$i++)
    {
   
       
$table['salesman'] = $sales[rand(0,4)];
       
$table['city'] = $city[rand(0,4)];
       
$table['product'] = $prods[rand(0,4)];
       
$table['month'] = $month[rand(0,4)];
       
$table['qty'] = rand(10,20);
       
$table['sum'] = $table['qty'] * 500;
       
$data[] = $table;
    }
   
   
$rd->SetSourceData($data);
   
    }

$rd->SetHorizontal(["month","city"]);
$rd->SetVertical(["salesman","product"]);
$rd->SetData(["qty","sum"]);
$rd->labels['qty'] = 'pcs';
$rd->labels['sum'] = 'usd';
$rd->title = 'PHP reportDesigner Demo';
$rd->description = 'Demo report';
$rd->PerformIfAction('./reporter.css','','','./pdf/mpdf.php');
$rd->cache_on = true;
$rd->TransformData();

?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Demo PHP RepDesigner</title>
    <meta http-equiv="cache-control" content="max-age=0" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="expires" content="0" />
    <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
    <meta http-equiv="pragma" content="no-cache" />
    <meta name="viewport" content="width=960"/>
    </head>
      <link rel="stylesheet" href="./css/reporter.css" />
     <script type="text/javascript" src="./js/jq.js"></script>
     <script type="text/javascript" src="./js/repdesigner.js"></script>
  </head>
  <body>
    <?php
   
echo $rd->DrawTb();
   
?>
</body>
  </html>