<?php

require_once "../../../load.koolreport.php";
use \koolreport\processes\Map;
use \koolreport\processes\Limit;
use \koolreport\processes\Filter;
use \koolreport\cube\processes\Cube;
use \koolreport\pivot\processes\Pivot;
use \koolreport\processes\ColumnMeta;
use \koolreport\processes\Sort;
use \koolreport\processes\RemoveColumn;
use \koolreport\processes\OnlyColumn;
use \koolreport\core\Utility as Util;

class Report extends \koolreport\KoolReport


{
        use \koolreport\excel\BigSpreadsheetExportable;
        	use \koolreport\cloudexport\Exportable;


    use \koolreport\inputs\Bindable;
    use \koolreport\inputs\POSTBinding;

    protected function defaultParamValues()
    {
        return array(
            "dateRange"=>array(date("Y-m-d 00:00:00"),date("Y-m-d 23:59:59")),
            "textBox"=>"KoolReport is great",
            "select"=>"",
            "multiSelect"=>array(),
            "radioList"=>"",
            "checkBoxList"=>array(),
            "startDatePicker"=>date("Y-m-d 00:00:00"),
            "endDatePicker"=>date("Y-m-d 23:59:59"),
            "rangeSliderOne"=>array(50),
            "rangeSliderTwo"=>array(20,80),
        );
    }

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

            "select",
            "multiSelect",
            "textBox",
            "radioList",
            "checkBoxList",
            "startDatePicker",
            "endDatePicker",
            "singleSelect2",
            "multipleSelect2",
            "singleBSelect",
            "multipleBSelect",
            "rangeSliderOne",
            "rangeSliderTwo",
        );
    }

    public function settings()
    {
        $config = include "../../../config.php";
        return array(
            "dataSources"=>array(
                "databasetest"=>$config["databasetest"]            )
            
        );
    }   
    protected function setup()
    {
        
        
        $this->src("databasetest")->query("
SELECT * FROM `ea_services`

        ")
        ->pipe($this->dataStore("customers"));
        
 

        $this->src("databasetest")->query("

SELECT firstname, lastname, email, phonenumber, notes, pharmacynotes, 
CONCAT("."'".Config::BASE_URL."'".",'/waitlistedit.php?q=',waitlist.hash) as editurl, 
CONCAT("."'".Config::BASE_URL."'".",'/waitlistdelete.php?q=', waitlist.hash) as deleteurl, 
CONCAT("."'".Config::BASE_URL."'".",'/index.php/backend?waitlist=y&wid=', waitlist.id) as inserturl
FROM waitlist WHERE status='' AND service=:service")
    
->params(array(
        

            ":service"=>$this->params["customers"],

        ))
        

    ->pipe($this->dataStore("myappts"));     


        
        
    }
    
    
}
