Identificar movimientos nuevos y obsoletos
This commit is contained in:
@ -99,4 +99,18 @@ class Movimiento extends Ideal\Repository
|
||||
}
|
||||
return $this->fetchMany($query, [$sociedad_rut, $mes->format('Y-m-01'), $mes->format('Y-m-t')]);
|
||||
}
|
||||
public function fetchMissingInDateRange(int $cuenta_id, DateTimeInterface $startDate, DateTimeInterface $endDate, array $idList = []): array
|
||||
{
|
||||
$query = $this->connection->getQueryBuilder()
|
||||
->select()
|
||||
->from($this->getTable())
|
||||
->where('cuenta_id = ? AND fecha BETWEEN ? AND ?');
|
||||
if (count($idList) > 0) {
|
||||
$idString = implode(', ', array_map(function(int $id) {
|
||||
return $this->connection->getPDO()->quote($id);
|
||||
}, $idList));
|
||||
$query->where("id NOT IN ({$idString})");
|
||||
}
|
||||
return $this->fetchMany($query, [$cuenta_id, $startDate->format('Y-m-d'), $endDate->format('Y-m-d')]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user