Venta->Listado->Cierres

This commit is contained in:
Juan Pablo Vial
2023-07-25 17:03:57 -04:00
parent 1a7b10ce3c
commit 43cd955061
12 changed files with 596 additions and 5 deletions

View File

@ -71,7 +71,7 @@ FROM `{$this->getTable()}` a
FROM `estado_cierre` e1
JOIN (SELECT MAX(`id`) AS id, `cierre` FROM `estado_cierre` GROUP BY `cierre`) e0 ON e0.`id` = e1.`id`) ec ON ec.`cierre` = a.`id`
JOIN `tipo_estado_cierre` tec ON tec.`id` = ec.`tipo`
JOIN `proyecto` ON `proyecto`.`id` = a.`proyecto`
JOIN `proyecto` ON `proyecto`.`id` = a.`proyecto` AND tec.`descripcion` NOT IN ('revisado')
GROUP BY `proyecto`.`descripcion`, tec.`descripcion`";
$results = $this->connection->execute($query)->fetchAll(PDO::FETCH_ASSOC);
if ($results === false) {
@ -79,4 +79,15 @@ GROUP BY `proyecto`.`descripcion`, tec.`descripcion`";
}
return $results;
}
public function fetchByProyecto(int $proyecto_id): array
{
$query = "SELECT a.*
FROM `{$this->getTable()}` a
JOIN (SELECT e1.*
FROM `estado_cierre` e1
JOIN (SELECT MAX(`id`) AS id, `cierre` FROM `estado_cierre` GROUP BY `cierre`) e0 ON e0.`id` = e1.`id`) ec ON ec.`cierre` = a.`id`
JOIN `tipo_estado_cierre` tec ON tec.`id` = ec.`tipo`
WHERE `proyecto` = ? AND tec.`descripcion` NOT IN ('revisado')";
return $this->fetchMany($query, [$proyecto_id]);
}
}