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 "../../../load.koolreport.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>
             
                    
            
    
                
                        
            | employeeNumber | lastName | firstName | extension | email | officeCode | reportsTo | jobTitle | 
        
                        
                        
                                        | 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 |