Movimientos filtrados y editables
This commit is contained in:
@ -78,4 +78,16 @@ class Movimiento extends Ideal\Repository
|
||||
->limit($amount, $start);
|
||||
return $this->fetchMany($query);
|
||||
}
|
||||
public function fetchAmountBySociedadAndMes(int $sociedad_rut, DateTimeInterface $mes, ?int $amount): array
|
||||
{
|
||||
$query = $this->connection->getQueryBuilder()
|
||||
->select('a.*')
|
||||
->from("{$this->getTable()} a")
|
||||
->joined('JOIN cuenta b ON a.cuenta_id = b.id')
|
||||
->where('b.inmobiliaria = ? AND a.fecha BETWEEN ? AND ?');
|
||||
if ($amount !== null) {
|
||||
$query->limit($amount);
|
||||
}
|
||||
return $this->fetchMany($query, [$sociedad_rut, $mes->format('Y-m-01'), $mes->format('Y-m-t')]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user