List of order

Choose date ranges and customer to view orders

Customer#OrderProductAmountStatus
Baane Mini Imports 10103 1952 Alpine Renault 1300 $5,572 Shipped
Baane Mini Imports 10103 1962 LanciaA Delta 16V $5,026 Shipped
Baane Mini Imports 10103 1958 Setra Bus $3,284 Shipped
Baane Mini Imports 10103 1940 Ford Pickup Truck $3,308 Shipped
Baane Mini Imports 10103 1926 Ford Fire Engine $1,283 Shipped
Baane Mini Imports 10103 1913 Ford Model T Speedster $2,489 Shipped
Baane Mini Imports 10103 1934 Ford V8 Coupe $2,164 Shipped
Baane Mini Imports 10103 18th Century Vintage Horse Carriage $2,173 Shipped
Baane Mini Imports 10103 1917 Maxwell Touring Car $3,970 Shipped
Baane Mini Imports 10103 1940s Ford truck $3,531 Shipped
Baane Mini Imports 10103 1939 Cadillac Limousine $1,671 Shipped
Baane Mini Imports 10103 1962 Volkswagen Microbus $3,864 Shipped
Baane Mini Imports 10103 1936 Chrysler Airflow $2,216 Shipped
Baane Mini Imports 10103 1980’s GM Manhattan Express $2,866 Shipped
Baane Mini Imports 10103 1996 Peterbilt 379 Stake Bed with Outrigger $2,851 Shipped
Baane Mini Imports 10103 1982 Camaro Z28 $3,951 Shipped
Blauer See Auto, Co. 10101 1932 Model A Ford J-Coupe $2,702 Shipped
Blauer See Auto, Co. 10101 1928 Mercedes-Benz SSK $4,344 Shipped
Blauer See Auto, Co. 10101 1939 Chevrolet Deluxe Coupe $1,464 Shipped
Blauer See Auto, Co. 10101 1938 Cadillac V-16 Presidential Limousine $2,040 Shipped
Vitachrome Inc. 10102 1937 Lincoln Berline $3,726 Shipped
Vitachrome Inc. 10102 1936 Mercedes-Benz 500K Special Roadster $1,768 Shipped
Online Diecast Creations Co. 10100 1917 Grand Touring Sedan $4,080 Shipped
Online Diecast Creations Co. 10100 1911 Ford Town Car $2,755 Shipped
Online Diecast Creations Co. 10100 1932 Alfa Romeo 8C2300 Spider Sport $1,660 Shipped
Online Diecast Creations Co. 10100 1936 Mercedes Benz 500k Roadster $1,729 Shipped

This example demonstrates the basic usage of widgets in Inputs package. The example uses DateRangePicker and MultiSelect widget to let user input range of date and list of customer. Upon receiving date range and list of customers as inputs, the report will list all orders of those customers within selected date range.

Although, it is not required but very essential to build dynamic reports or dashboards. If you dont use Inputs package, it is fine. You can construct your own form to let user keys and then you use them as parameters for reports. Inputs package does the same thing so that you don't need to do it.

More information of Inputs package and its documentation, you may find here.

<?php 
require_once "OrderList.php";
$report = new OrderList;
$report->run()->render();
<?php

require_once "../../../../koolreport/autoload.php";

use \koolreport\KoolReport;

class OrderList extends KoolReport
{
    use \koolreport\amazing\Theme;
    use \koolreport\inputs\Bindable;
    use \koolreport\inputs\POSTBinding;

    protected function defaultParamValues()
    {
        return array(
            "dateRange"=>array(
                "2003-01-01",
                "2003-01-31"
            ),
            "customers"=>array(),
        );
    }

    protected function bindParamsToInputs()
    {
        return array(
            "dateRange"=>"dateRange",
            "customers"=>"customers",
        );
    }

    public function settings()
    {
        $config = include "../../../config.php";
        return array(
            "dataSources"=>array(
                "automaker"=>$config["automaker"]
            )
        );
    }   
    protected function setup()
    {
        $this->src('automaker')
        ->query("
            SELECT
                customers.customerName,
                orders.orderNumber,
                products.productName,
                orderdetails.quantityOrdered*orderdetails.priceEach as amount,
                orders.orderDate,
                orders.status
            FROM 
                orders
            JOIN 
                customers
            ON 
                customers.customerNumber = orders.customerNumber
            ".
            (($this->params["customers"]!=array())?"AND customers.customerNumber IN (:customers)":"")
            ."
            JOIN 
                orderdetails
            ON 
                orders.orderNumber = orderdetails.orderNumber
            JOIN 
                products
            ON
                products.productCode = orderdetails.productCode
            WHERE
                orderDate > :start
                AND
                orderDate < :end
        ")
        ->params(array(
            ":start"=>$this->params["dateRange"][0],
            ":end"=>$this->params["dateRange"][1],
            ":customers"=>$this->params["customers"]
        ))
        ->pipe($this->dataStore("result"));

        $this->src("automaker")->query("
            SELECT
                customerNumber,
                customerName
            FROM
                customers
            ORDER BY customerName
        ")
        ->pipe($this->dataStore("customers"));
    } 
}
<?php 
    use \koolreport\widgets\koolphp\Table;
    use \koolreport\inputs\DateRangePicker;
    use \koolreport\inputs\MultiSelect;
?>
<div class="report-content">
    <div class="text-center">
        <h1>List of order</h1>
        <p class="lead">Choose date ranges and customer to view orders</p>
    </div>
    <form method="post">
        <div class="row">
            <div class="col-md-8 offset-md-2">
                <div class="form-group">
                <?php
                DateRangePicker::create(array(
                    "name"=>"dateRange"
                ))
                ?>
                </div>
                <div class="form-group">
                <?php
                MultiSelect::create(array(
                    "name"=>"customers",
                    "dataStore"=>$this->dataStore("customers"),
                    "dataBind"=>array(
                        "text"=>"customerName",
                        "value"=>"customerNumber",
                    ),
                    "attributes"=>array(
                        "class"=>"form-control",
                        "size"=>10,
                    )
                ));
                ?>
                </div>
                <div class="form-group text-center">
                    <button class="btn btn-success"><i class="glyphicon glyphicon-refresh"></i> Load</button>
                </div>
            </div>
        </div>
    </form>


    <?php
    if($this->dataStore("result")->countData()>0)
    {
        Table::create(array(
            "dataStore"=>$this->dataStore("result"),
            "removeDuplicate"=>array("customerName","orderNumber"),
            "cssClass"=>array(
                "table"=>"table table-bordered"
            ),
            "columns"=>array(
                "customerName"=>array(
                    "label"=>"Customer",
                ),
                "orderNumber"=>array(
                    "label"=>"#Order",
                    "type"=>"string",
                ),
                "productName"=>array(
                    "label"=>"Product"
                ),
                "amount"=>array(
                    "label"=>"Amount",
                    "prefix"=>"$",
                ),
                "status"=>array(
                    "label"=>"Status",
                )

            )
        ));
    }
    else
    {
    ?>
        <div class="alert alert-warning">
            <i class="glyphicon glyphicon-info-sign"></i> Sorry, we found no orders found
        </div>
    <?php    
    }
    ?>
</div>
employeeNumberlastNamefirstNameextensionemailofficeCodereportsTojobTitle
1,002 Murphy Diane x5800 dmurphy@classicmodelcars.com 1 0 President
1,056 Patterson Mary x4611 mpatterso@classicmodelcars.com 1 1,002 VP Sales
1,076 Firrelli Jeff x9273 jfirrelli@classicmodelcars.com 1 1,002 VP Marketing
1,088 Patterson William x4871 wpatterson@classicmodelcars.com 6 1,056 Sales Manager (APAC)
1,102 Bondur Gerard x5408 gbondur@classicmodelcars.com 4 1,056 Sale Manager (EMEA)
1,143 Bow Anthony x5428 abow@classicmodelcars.com 1 1,056 Sales Manager (NA)
1,165 Jennings Leslie x3291 ljennings@classicmodelcars.com 1 1,143 Sales Rep
1,166 Thompson Leslie x4065 lthompson@classicmodelcars.com 1 1,143 Sales Rep
1,188 Firrelli Julie x2173 jfirrelli@classicmodelcars.com 2 1,143 Sales Rep
1,216 Patterson Steve x4334 spatterson@classicmodelcars.com 2 1,143 Sales Rep
1,286 Tseng Foon Yue x2248 ftseng@classicmodelcars.com 3 1,143 Sales Rep
1,323 Vanauf George x4102 gvanauf@classicmodelcars.com 3 1,143 Sales Rep
1,337 Bondur Loui x6493 lbondur@classicmodelcars.com 4 1,102 Sales Rep
1,370 Hernandez Gerard x2028 ghernande@classicmodelcars.com 4 1,102 Sales Rep
1,401 Castillo Pamela x2759 pcastillo@classicmodelcars.com 4 1,102 Sales Rep
1,501 Bott Larry x2311 lbott@classicmodelcars.com 7 1,102 Sales Rep
1,504 Jones Barry x102 bjones@classicmodelcars.com 7 1,102 Sales Rep
1,611 Fixter Andy x101 afixter@classicmodelcars.com 6 1,088 Sales Rep
1,612 Marsh Peter x102 pmarsh@classicmodelcars.com 6 1,088 Sales Rep
1,619 King Tom x103 tking@classicmodelcars.com 6 1,088 Sales Rep
1,621 Nishi Mami x101 mnishi@classicmodelcars.com 5 1,056 Sales Rep
1,625 Kato Yoshimi x102 ykato@classicmodelcars.com 5 1,621 Sales Rep
1,702 Gerard Martin x2312 mgerard@classicmodelcars.com 4 1,102 Sales Rep

What People Are Saying

"KoolReport helps me very much in creating data report for my corporate! Keep up your good work!"
-- Alain Melsens

"The first use of your product. I was impressed by its easiness and powerfulness. This product is a great and amazing."
-- Dr. Lew Choy Onn

"Fantastic framework for reporting!"
-- Greg Schneider

Download KoolReport