KoolReport's Forum

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

First time - MySQL #600

Open iterp opened this topic on on Jan 21, 2019 - 7 comments

iterp commented on Jan 21, 2019

I can not implement it. Give me a 500 error. Can you help me?

index.php ` <?php

require_once "koolreport/oportunidade/OpMes.php"; $report = new OpMes; $report->run()->render(); `

OpMes.php

<?php

require_once "koolreport/autoload.php";

use \koolreport\KoolReport;
use \koolreport\processes\Filter;
use \koolreport\processes\TimeBucket;
use \koolreport\processes\Group;
use \koolreport\processes\Limit;

class OpMes extends KoolReport
{
    function settings()
    {
        return array(
            "dataSources"=>array(
                "op_mes"=>array(
                    "connectionString"=>"mysql:host=localhost;dbname=almafor2_grav326",
                    "username"=>"almafor2_grav326",
                    "password"=>"xxxx",
                    "charset"=>"utf8"
                ),
            )
        ); 
    }    
    protected function setup()
    {
        $this->src('op_mes')
        ->query("SELECT estimated_date,estimated FROM u_yf_ssalesprocesses")
        ->pipe(new TimeBucket(array(
            "estimated_date"=>"month"
        )))
        ->pipe(new Group(array(
            "by"=>"estimated_date",
            "sum"=>"estimated"
        )))
        ->pipe($this->dataStore('op1_by_month'));
    } 
}

OpMes.view.php

<?php 
    use \koolreport\widgets\koolphp\Table;
    use \koolreport\widgets\google\ColumnChart;
?>

<div class="report-content">
    <div class="text-center">
        <h1>Oportunidades - Valor Estimado por Mês</h1>
        <p class="lead">Este relatório foi efectuado com muito engenho e arte</p>
    </div>

    <?php
    ColumnChart::create(array(
        "dataStore"=>$this->dataStore('op1_by_month'),  
        "columns"=>array(
            "estimated_date"=>array(
                "label"=>"Mês",
                "type"=>"datetime",
                "format"=>"Y-n",
                "displayFormat"=>"F, Y",
            ),
            "amount"=>array(
                "label"=>"ValorEuros",
                "type"=>"number",
                "prefix"=>"$",
            )
        ),
        "width"=>"100%",
    ));
    ?>

    <?php
    Table::create(array(
        "dataStore"=>$this->dataStore('op1_by_month'),
        "columns"=>array(
            "estimated_date"=>array(
                "label"=>"Mês",
                "type"=>"datetime",
                "format"=>"Y-n",
                "displayFormat"=>"F, Y",
            ),
            "amount"=>array(
                "label"=>"ValorEuros",
                "type"=>"number",
                "prefix"=>"$",
                        )
        ),
        "cssClass"=>array(
            "table"=>"table table-hover table-bordered"
        )
    ));
    ?>
	
</div>
iterp commented on Jan 21, 2019

Error Log:

[21-Jan-2019 10:28:15 Europe/Lisbon] PHP Warning: require_once(koolreport/oportunidade/OpMes.php): failed to open stream: No such file or directory in /home/almafor2/public_html/koolreport/oportunidade/index.php on line 3 [21-Jan-2019 10:28:15 Europe/Lisbon] PHP Fatal error: require_once(): Failed opening required 'koolreport/oportunidade/OpMes.php' (include_path='.:/opt/alt/php71/usr/share/pear') in /home/almafor2/public_html/koolreport/oportunidade/index.php on line 3

iterp commented on Jan 23, 2019

I have received more than 3 discounted emails to buy the KoolReport Pro version. The only way I can opt for the Pro version is to be confident that it works.

If I ask questions here in the forum and nobody from the support helps me, I find it difficult to acquire whatever it is ...

(Just a thought ....)

:(

David Winterburn commented on Jan 23, 2019

Hi iterp,

Please test that this path is correct from the directory containing "index.php": koolreport/oportunidade/OpMes.php. If your server/localhost is case-sensitive please make sure the file/directory names are correct case-sensitively.

In any case, please let us know of your web project directory structure to us to check for you. Thanks!

iterp commented on Jan 23, 2019

índex.php file

<?php 

require_once "koolreport/oportunidade/OpMes.php";
$report = new OpMes;
$report->run()->render();
KoolReport commented on Jan 23, 2019

Hi, It seems to me the index.php and the OpMes.php in the same directory so you only need to:

require_once "OpMes.php";
iterp commented on Jan 24, 2019

The same… Give me a 500 error.

Error Log [24-Jan-2019 10:28:49 Europe/Lisbon] PHP Warning: require_once(koolreport/autoload.php): failed to open stream: No such file or directory in /home/almafor2/public_html/koolreport/oportunidade/OpMes.php on line 3

[24-Jan-2019 10:28:49 Europe/Lisbon] PHP Fatal error:  require_once(): Failed opening required 'koolreport/autoload.php' (include_path='.:/opt/alt/php71/usr/share/pear') in /home/almafor2/public_html/koolreport/oportunidade/OpMes.php on line 3

KoolReport commented on Jan 24, 2019

you need to do this inside your OpMes.php

requiree_once "../autoload.php";

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
help needed

None