Hello, I got two different DataStores ( one MySQL and one SQl Server). I'm doing a leftjoin, where the DataStore has 722 rows, but the resulting table has 736 rows, why do you think this is?
MyReport.php
<?php
// Require autoload.php from koolreport library
require_once "../../koolreport/core/autoload.php";
use \koolreport\processes\Join;
//Step 2: Creating Report class
class MyReport extends \koolreport\KoolReport
{
use \koolreport\amazing\Theme;
use \koolreport\inputs\Bindable;
use \koolreport\inputs\POSTBinding;
protected function defaultParamValues()
{
return array(
"dateRange"=>array(
date("Y-m-d", strtotime('-7 days')) . " 00:00:00",
date("Y-m-d", strtotime('-0 days')) . " 23:59:59"
),
"customers"=> "",
);
}
protected function bindParamsToInputs()
{
return array(
"dateRange"=>"dateRange",
"customers"=>"customers"
);
}
public function settings()
{
return array(
"dataSources"=>array(
XXX
)
);
}
public function setup()
{
$query="
SELECT
....
UPPER(lpa.cartaporte) AS 'Carta Porte',
...
FROM....
";
$this->src('automaker')
->query($query)
->params(array(
":customers" => $this->params["customers"],
":start"=> $this->params["dateRange"][0],
":end"=> $this->params["dateRange"][1]
))
->saveTo($plibro)
->pipe($this->dataStore('libro'));
$query2="SELECT
tg.fecha_guia,
tg.num_guia,
trg.cantidad,
trg.volumen_m3
FROM trafico_guia tg
LEFT JOIN trafico_renglon_guia trg
ON trg.id_area = tg.id_area
AND trg.no_guia = tg.no_guia
WHERE tg.id_area = 3
AND tg.status_guia <> 'B'";
$this->src('sqlserver')
->query($query2)
->saveTo($pZAM)
->pipe($this->dataStore('ZAM'));
$this->src("automaker")->query("SELECT nombre, id_planta FROM cat_linde_cargaen")
->pipe($this->dataStore("planta"));
}
}
MyReport.view.php
<?php
use \koolreport\inputs\Select2;
use \koolreport\inputs\DateRangePicker;
use \koolreport\chartjs\ColumnChart;
use \koolreport\datagrid\DataTables;
date_default_timezone_set("America/Mexico_City");
$dt = date('dmYHi');
?>
<head>
<title>Libro Azul</title>
</head>
<div class="container-fluid app-container">
<div style="margin-bottom:20px;"></div>
<div class="card card-accent-primary">
<div class="card-body smart-title">
<div class="doc-content"><h1>Libro Azul</h1>
<p>V.10</p>
<hr>
<div class="row">
<div class="col-md-4">
<form method="post">
<div class="form-group">
<?php
DateRangePicker::create(array(
"name"=>"dateRange"
))
?>
</div>
<div class="form-group text-center">
<button class="btn btn-success"><i class="glyphicon glyphicon-refresh"></i>Cargar</button>
</div>
</form>
</div>
</div>
<hr>
<div class="row">
<div class= "col-md-12 form-group">
<?php
$new_store = $this->dataStore('libro')->leftJoin($this->dataStore('ZAM'),array("Carta Porte"=>"num_guia"));
DataTables::create(array(
"dataSource"=>$new_store,
"cssClass"=> array(
"td" => "text-center",
"th" => "text-center",
),
)
);
?>
</div>
</div>
</div>
</div>
</div>
</div>