sorry if that topic already exists, but I didn’t succeed with any of the examples I found. I need to get the date parameters entered by the user in the report.view.php input and pass in the report.php query. I managed to pass a fixed parameter, but I have doubts on how to bring this parameter from the view to the query in report.php. Sorry if that sounds easy, but I don't know.
My report.view.php
<h2 id="texto">Relatório de Vendas</h2>
<form action="VendasIndex.php" method="post">
<label for="DataDe">Data De:</label>
<input type="date" name="DataDe" id="">
<label for="DataAte">Data Até:</label>
<input type="date" name="DataAte" id="">
<input type="button" value="Pesquisar">
</form>
<?php
\koolreport\widgets\koolphp\Table::create(array(
"dataSource"=>$this->dataStore('resultDados'),
));
?>
my report.php
protected function setup()
{
$this->src("conexao")
->query("Select v.CODIGO_VENDA as NUM_VENDA , v.CODIGO_CLIENTE ,c.NOME,v.NUM_PECAS,v.VALOR,v.DESCONTO,v.TOTAL -isnull(z.ValorNaoDevido,0) TOTAL,v.TIPO_VENDA,v.STATUS_VENDA,Case when f.CREDIARIO = 'CREDIÁRIO' then 'Sim' else 'Não' end as CREDIARIO, isnull(s.Integrado, 'Não') as Integrado
from VENDAS v
inner join CLIENTE c
on v.CODIGO_CLIENTE = c.CODIGO
and v.LOJA = c.LOJA
left join(Select CODIGO_VENDA, LOJA,'CREDIÁRIO' as CREDIARIO from FORMA_PAGAMENTO_VENDA where TIPO_FORMA_PGTO = 'CREDIÁRIO' group by CODIGO_VENDA,LOJA) as f
on v.CODIGO_VENDA = f.CODIGO_VENDA
and v.LOJA = f.LOJA
left join(SELECT codigoVenda, 'Sim' Integrado
FROM MovimentoSAT
WHERE CodigoRetornoEEEEE = 6000
GROUP BY codigoVenda) as S on v.CODIGO_VENDA = S.codigoVenda
left join( Select f.CODIGO_VENDA,f.LOJA, SUM(f.VALOR) as ValorNaoDevido
from VENDAS v inner join FORMA_PAGAMENTO_VENDA f on v.CODIGO_VENDA = f.CODIGO_VENDA
where TIPO_FORMA_PGTO in ('CREDITO', 'BRINDE', 'VALEPRESENTE')
and v.STATUS_VENDA = 'Finalizado'
group by f.CODIGO_VENDA,f.LOJA) as z on v.CODIGO_VENDA = z.CODIGO_VENDA and v.LOJA = z.LOJA where 1=1 and DATA>=:DATA ")
->params(array(
":DATA"=>$this->params["DATA"]
))
->pipe($this->dataStore("resultDados"));
}
my index.php
<?php
require_once "./vendor/autoload.php";
require_once "VendasReport.php";
$report = new ReportVendas(array(
"DATA"=>'2021-01-01'
));
$report->run()->render();
?>
Thank your for attention!