Ventas->Listado->Ventas
This commit is contained in:
@ -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]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user