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

@ -30,7 +30,6 @@ class Unidad extends Ideal\Repository
];
return $this->parseData(new Model\Venta\Unidad(), $data, $map);
}
public function save(Define\Model $model): Define\Model
{
$model->id = $this->saveNew(
@ -39,9 +38,20 @@ class Unidad extends Ideal\Repository
);
return $model;
}
public function edit(Define\Model $model, array $new_data): Define\Model
{
return $this->update($model, ['subtipo', 'piso', 'descripcion', 'orientacion', 'pt'], $new_data);
}
public function fetchByCierre(int $cierre_id): array
{
$query = "SELECT a.*
FROM `{$this->getTable()}` a
JOIN `unidad_cierre` uc ON uc.`unidad` = a.`id`
JOIN `proyecto_tipo_unidad` ptu ON ptu.`id` = a.`pt`
JOIN `tipo_unidad` tu ON tu.`id` = ptu.`tipo`
WHERE uc.`cierre` = ?
ORDER BY tu.`orden`, LPAD(a.`descripcion`, 4, '0')";
return $this->fetchMany($query, [$cierre_id]);
}
}