KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.

HELP with DateRangePicker #920

Open paulo opened this topic on 7 days ago - 2 comments

paulo commented 7 days ago

Hi, I am trying to follow the example https://www.koolreport.com/examples/reports/inputs/order_list/ but I am getting no results. If I remove the databapicker filter, I see the results. I've tried Get and POST. With and without the 'load' button. When I add the load button I and click on it I get "419 Page Expired"

HEre is my info:

 use \koolreport\inputs\POSTBinding;
    protected function defaultParamValues()
    {
        $start_date = date('Y-m-d', strtotime('first day of last month'));
        $end_date = date('Y-m-d', strtotime('last day of last month'));
        return array(
           // "dateRange"=>array(date("Y-m-d 00:00:00"),date("Y-m-d 23:59:59"))
            "dateRange"=>array(
                $start_date,
                $end_date
            ),
        );
    }

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

 function setup()
    {
...
 WHERE ST.status = \"active\" and T.tour_status !=\"0\" AND T.startDate > :start  AND  T.endDate < :end
                    ORDER BY T.startDate")
               ->params(array(
                   ":start"=>$this->params["dateRange"][0],
                   ":end"=>$this->params["dateRange"][1]
              ))
            ->pipe($this->dataStore('oncalltours'));

Now, in the view:

   <form method="post">
        <div class="row">
            <div class="col-md-8 offset-md-2">

                <strong>Date Range Picker</strong>
                <?php
                DateRangePicker::create(array(
                    "name" => "dateRange",
                ));
                ?>

                <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("oncalltours")->countData() > 0) {
                Table::create(array(
                    "dataStore" => $this->dataStore("oncalltours"),
                    "options" => array(
                        //"searching"=>true,
                        "fixedHeader" => true,
                        "ordering" => true,
                    ),
                    "cssClass" => array(
                        "table" => "table table-bordered"
                    ),
                    "columns" => array(
                        "id" => array(
                            "type" => "text",
                            "label" => "id",
                            "formatValue" => "<a href='https://my.ellisontravel.com/tour/tours/@value'>@value</a>"
                        ),
                        "client" => array(
                            "type" => "text",
                            "label" => "Client(s)"
                        ),
                        "tourname" => array(
                            "type" => "text",
                            "label" => "Tours"
                        ),
                        "onCall",
                        "Visitor",
                        "Planner",
                        "Manager",
                        "startDate",
                        "endDate",
                        "country",
                        "psgr",
                        "status"

                    )
                ));
            } else {
                ?>
                <div class="alert alert-warning">
                    <i class="glyphicon glyphicon-info-sign"></i> Sorry, we found no orders found
                </div>
                <?php
            }
            ?>


        </div>

thank you very much for helping Paulo

KoolReport commented 6 days ago

Do you use in anykinds of framework?

paulo commented 5 days ago

yes, we are a Laravel shop. I've updated to the latest version of KoolReport. thanks

Give tips to supporter for his good work

If you feel that supporter has done a good work, consider giving him some credit. Any amount put into the tips box below is appreciated. By doing so, you have contribtuted to the existence of KoolReport and the quality of support.

Tips box
help needed

Inputs