Ventas->Listado->Ventas

This commit is contained in:
Juan Pablo Vial
2023-07-28 16:22:20 -04:00
parent 38383f5295
commit ef30ae67d2
52 changed files with 1496 additions and 17 deletions

View File

@ -43,6 +43,15 @@ class Unidad extends Ideal\Repository
return $this->update($model, ['subtipo', 'piso', 'descripcion', 'orientacion', 'pt'], $new_data);
}
public function fetchByPropiedad(int $propiedad_id): array
{
$query = "SELECT a.*
FROM `{$this->getTable()}` a
JOIN `propiedad_unidad` pu ON pu.`unidad` = a.`id`
WHERE pu.`propiedad` = ?
GROUP BY a.`id`";
return $this->fetchMany($query, [$propiedad_id]);
}
public function fetchByCierre(int $cierre_id): array
{
$query = "SELECT a.*
@ -51,6 +60,7 @@ FROM `{$this->getTable()}` a
JOIN `proyecto_tipo_unidad` ptu ON ptu.`id` = a.`pt`
JOIN `tipo_unidad` tu ON tu.`id` = ptu.`tipo`
WHERE uc.`cierre` = ?
GROUP BY a.`id`
ORDER BY tu.`orden`, LPAD(a.`descripcion`, 4, '0')";
return $this->fetchMany($query, [$cierre_id]);
}