-1
Good afternoon, thanks for your help. Can you help me create this parameter search method please? I started editing it, but the problem is that I can’t generate this method using a variable that’s present on the screen. For example, I did as follows: $result = $obj->getAll('usuarios_id IN (SELECT usuarios_id FROM usuarios WHERE empresas_id = 12'); In this case it works, and displays the results of the company_id = 12. I’m trying to modify to pass a parameter instead of a fixed value (12). I tried this: $result = $obj->getAll('usuarios_id IN (SELECT usuarios_id FROM usuarios WHERE empresas_id = ". $empresa." '); It doesn’t return any results. I’m having difficulty passing this $company parameter. The method was like this: public Function excelRelatorio() { $arrayRow = array('Name','Form Payment','Status', 'KM','Value', 'Extra Value', 'Date'); $this->geraExcelRelatorio($arrayRow); }
private function geraExcel($arrayRow,$empresa)
{
$this->load->helper('xls');
$arr[] = $arrayRow;
$obj = new Viagem();
$result = $obj->getAll('usuarios_id IN (SELECT usuarios_id FROM usuarios WHERE empresas_id = ".$empresa."');
if (isset($result) && count($result) > 0) {
foreach ($result['rows'] as $v) {
$arr[] = array(
utf8_decode($v->getUsuario()->getNome()), $v->getFormaPagamento()->getNome(), $v->getStatus()->getNome(), $v->getDistancia(), $v->getValor(), $v->getValorExtra(), dataHoraBr($v->getDataCriado()), $v->getEntregador()->getNome()
);
}
}
array_to_xls($arr, 'financeiro'.date("m-d-y").'.xls');
}
edited the question again. getAll() managed to edit a select inside it, but my problem is to pass variables in that select. With fixed value works, calling a variable does not.
– Mauricio3012