KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Use of DateRange Picker #1521

Open Richb201 opened this topic on on Jul 9, 2020 - 3 comments

Richb201 commented on Jul 9, 2020

I am trying to set up the dates for the report by sticking this code near the top of my MyReport.view.php.

                <?php
                DateRangePicker::create(array(
                    "name" => "dateRange",
                ));
                ?>

In the MyReport.php I have added these two:

   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"
        );
    }

I have copied the inputw directory to my /vendor/koolreport directory. I have also added this to the top of MyReport.php

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

I am getting an error when I try running this

Type: Error

Message: Class 'DateRangePicker' not found

Filename: /app/assets/MyReport.view.php

Please tell me what I missed doing in setup?

KoolReport commented on Jul 9, 2020

Let do

\koolreport\inputs\DateRangePicker::create(array(
    "name" => "dateRange",
));
Richb201 commented on Jul 9, 2020

Thx. It doesn't crash, but no picker appears at the top of the report. I changed it to:

<?php echo "<br><br><br><br><br><br><h3>Report for:  ".$_SESSION['campaign']." for tax year ended <?php \koolreport\inputs\DateRangePicker::create(array(\"name\" => \"dateRange\",));</h3>";?>

and this yields: Report for: Apple for tax year ended "dateRange",)); BTW, I really don't need a date range. Usually the date is specified by YYYYMM. is 202007. I just need them to type or pick the yearmonth for the end of the year.

Richb201 commented on Jul 13, 2020

OK. It has been 4 days since I posted this very simple problem. I will post it again. I am trying to let the user determine what year the report should be for. I am hoping to let them chose the "year" at the top of the displayed report. I have tried using DatePicker as per you directions I am using it like this: <?php echo "<br><br><br><br><br><br><h3>Report for: ".$_SESSION['campaign']." for tax year ended". \koolreport\inputs\DateRangePicker::html(array("name" => "dateRange","format"=>"YYYYMM"));?> I am attaching the resulting report.

As you can see the Date Range picker is blank. What I really want is the user to pick a date like YYYYMM of their choice. If I can't do this within a report, just let me know and I will work on putting it somewhere else in my CodeIgniter application.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

None