Oops, good afternoon, thanks for the help. Can you help me create this parameter search method please? I started editing it, but the problem is that I can not generate this method using a variable that is present on the screen. For example, I did the following: $ result = $ obj-> getAll ('id_id users (SELECT users_id FROM users WHERE business_id = 12'); In this case it works, and displays the results of company_id = 12. I'm trying to modify to pass a parameter instead of fixed value (12). I tried this way: $ result = $ obj-> getAll ('users_id IN (SELECT users_id FROM users WHERE companies_id=". $ company."'); It does not return any results. I'm having difficulty passing this $ company parameter. The method looks like this: public function excelReport () { $ arrayRow = array ('Name', 'Payment Form', 'Status', 'KM', 'Value', 'Extra Value', 'Data'); $ this-> geraExcelReport ($ 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');
}