|
@@ -13,24 +13,39 @@ class HerramientaObraController extends AuthController {
|
|
public function actionIndex() {
|
|
public function actionIndex() {
|
|
$id = trim($this->req->get("id", ""));
|
|
$id = trim($this->req->get("id", ""));
|
|
$buscar = trim($this->req->get("q", ""));
|
|
$buscar = trim($this->req->get("q", ""));
|
|
-
|
|
|
|
-
|
|
|
|
- $query = $this->queryInicial;
|
|
|
|
|
|
+ $empleado= trim($this->req->get("empleado",""));
|
|
|
|
+ $herramienta= trim($this->req->get("herramienta",""));
|
|
|
|
+ $obra= trim($this->req->get("obra",""));
|
|
|
|
+ $inicio= trim($this-> req->get("inicio", ""));
|
|
|
|
+ $fin= trim($this-> req->get("fin", ""));
|
|
|
|
+ $query = $this->queryInicial
|
|
|
|
+ -> innerJoin("Empleado","{{Empleado}}.[[id]] = {{HerramientaObra}}.[[idEmpleado]]")
|
|
|
|
+ -> innerJoin("Herramienta","{{Herramienta}}.[[id]] = {{HerramientaObra}}.[[idHerramienta]]")
|
|
|
|
+ -> innerJoin("Obra","{{Obra}}.[[id]] = {{HerramientaObra}}.[[idObra]]");
|
|
|
|
|
|
if($id > 0) {
|
|
if($id > 0) {
|
|
- $query->andWhere(["id" => $id]);
|
|
|
|
|
|
+ $query->andWhere(["{{HerramientaObra}}.id" => $id]);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ if($id !== "") {
|
|
|
|
+ $query->andWhere(["{{HerramientaObra}}.id" => $id]);
|
|
|
|
+ }
|
|
|
|
+ if ($empleado !== "") {
|
|
|
|
+ $query->andWhere(["like", "{{Empleado}}.[[nombre]]", $empleado]);
|
|
|
|
+ }
|
|
|
|
+ if($herramienta !== "") {
|
|
|
|
+ $query->andWhere(["{{Herramienta}}.id" => $herramienta]);
|
|
|
|
|
|
- if($buscar) {
|
|
|
|
-
|
|
|
|
- $query->andWhere([
|
|
|
|
- "OR",
|
|
|
|
- ["ilike", "idEmpleado", $buscar]
|
|
|
|
- ]);
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if($obra !== "") {
|
|
|
|
+ $query->andWhere(["{{Obra}}.id" => $obra]);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+ if($inicio !=="" && $fin !==""){
|
|
|
|
+ $query->andWhere(["between", "[[fechaServicio]]", $inicio,$fin]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
return new Respuesta($query, $this->limite, $this->pagina, $this->ordenar);
|
|
return new Respuesta($query, $this->limite, $this->pagina, $this->ordenar);
|
|
}
|
|
}
|