Pareces nuevo por aquí. Si quieres participar, ¡pulsa uno de estos botones!
<?= form_tag('instalaciones/filtrar/') ?> <b>Filtros<b><br> <b>Cliente</b> <?php print text_field_with_autocomplete("nombre","action: instalaciones/suger") ?><br> <b>Empleado</b> <?php print text_field_with_autocomplete("nombremp","action: instalaciones/sugeremp") ?><br> <b>Fecha de realizacion<b><br> Desde <br><br> Dia/Mes/Año <select name="diad"> <? for($i=1;$i<=31;$i++){?> <?if($i<=9){?> <option value =<?print "0".$i?>><? print "0".$i?></option> <?}else{?> <option value =<?print $i?>><? print $i?></option> <?}?> <?}?> </select> <select name="mesd"> <? for($b=1;$b<=12;$b++){?> <?if($b<=9){?> <option value =<?print "0".$b?>><? print "0".$b?></option> <?}else{?> <option value =<?print $b?>><? print $b?></option> <?}?> <?}?> </select> <select name="añod"> <? for($a=2008;$a<=2020;$a++){?> <?if($a<=9){?> <option value =<?print "0".$a?>><? print "0".$a?></option> <?}else{?> <option value =<?print $a?>><? print $a?></option> <?}?> <?}?> </select> <br><br> Hasta <br><br> Dia/Mes/Año <select name="diah"> <? for($i=1;$i<=31;$i++){?> <?if($i<=9){?> <option value =<?print "0".$i?>><? print "0".$i?></option> <?}else{?> <option value =<?print $i?>><? print $i?></option> <?}?> <?}?> </select> <select name="mesh"> <? for($b=1;$b<=12;$b++){?> <?if($b<=9){?> <option value =<?print "0".$b?>><? print "0".$b?></option> <?}else{?> <option value =<?print $b?>><? print $b?></option> <?}?> <?}?> </select> <select name="añoh"> <? for($a=2008;$a<=2020;$a++){?> <?if($a<=9){?> <option value =<?print "0".$a?>><? print "0".$a?></option> <?}else{?> <option value =<?print $a?>><? print $a?></option> <?}?> <?}?> </select> <br><br> <?= submit_tag('Filtrar')?> <? end_form_tag()?>
<h1>Listado de Instalaciones</h1> <br> <br> Visualizando instalaciones desde <?print session::get_data('fechadesde')?> hasta <?print session::get_data('fechahasta')?> <?if($oEmpleadoFiltro->id==''){?> <?print " del cliente " . $oClienteFiltro->id;?> <?$Consulta = "select *,i.id as idinst from instalaciones i where clientesid like '" . $oClienteFiltro->id ."%' and fechahorat BETWEEN '".$fechanewd. "%' and '".$fechanewh."%'"?> <?}else{?> <? print " realizadas por " .$oEmpleadoFiltro->id?> <?$Consulta = "select *,i.id as idinst from instalaciones i inner join InstalacionesPorEmpleados ipe on i.id = ipe.instalacionesid where clientesid like '" . $oClienteFiltro->id ."%' and ipe.empleados_id like '" . $oEmpleadoFiltro->id ."' and fechahorat BETWEEN '".$fechanewd. "%' and '".$fechanewh. "%'" ?> <?}?>
public function filtrar(){ $this->oEmpleadoFiltro = new Empleados(); $this->oClienteFiltro = new Clientes(); $this->oEmpleadoFiltro->nombre = $this->request("nombremp"); $this->oClienteFiltro->nombre = $this->request("nombre"); $fechad = $this->request('añod')."-".$this->request('mesd')."-".$this->request('diad'); $fechah = $this->request('añoh')."-".$this->request('mesh')."-".$this->request('diah'); if ($fechad!='00:00:00'){ $this->fechanewd = $fechad; if($fechah!='00:00:00'){ $this->fechanewh = $fechah; session::set_data('fechadesde',$fechad); session::set_data('fechahasta',$fechah); }else{$this->fechanewh = '';} }else{ $this->fechanew = ''; } if($this->oEmpleadoFiltro->nombre==''){ $this->oEmpleadoFiltro->id=''; session::set_data('empleadofiltro',''); }else{ $Empleados = new Empleados; $Empleados->nombre = $this->oEmpleadoFiltro->nombre; if($Empleados->find_first("conditions: nombre = '$Empleados->nombre'")){ $this->oEmpleadoFiltro->id = $Empleados->id; session::set_data('empleadofiltro',$Empleados->nombre); }else{flash::error ("No se ha encontrado el empleado para aplicar el filtro correspondiente.");} } if($this->oClienteFiltro->nombre==''){ $this->oClienteFiltro->id=''; session::set_data('clientefiltro',''); }else{ //print "<br>".$this->oClienteFiltro->nombre."<br><br>"; $Clientes = new Clientes; $Clientes->nombre = $this->oClienteFiltro->nombre; if($Clientes->find_first("conditions: nombre = '$Clientes->nombre'")){ $this->oClienteFiltro->id = $Clientes->id; session::set_data('clientefiltro',$Clientes->nombre); }else{flash::error ("No se ha encontrado el cliente para aplicar el filtro correspondiente.");} } }Eso es todo, espero puedan ayudarme y desde ya muchas gracias!