Consolidar command

This commit is contained in:
2022-03-25 15:04:10 -03:00
parent dbad283e14
commit ee3133da72
5 changed files with 33 additions and 13 deletions

View File

@ -60,10 +60,19 @@ class Cuenta extends Model {
return $this->consolidados;
}
public function hasConsolidados(): bool {
$t = Carbon::now();
return (bool) Model::factory(Consolidado::class)
->whereEqual('cuenta_id', $this->id)
->count('id');
}
public function hasConsolidadosPending(): bool {
$t = Carbon::now();
return !(bool) Model::factory(Consolidado::class)
->whereEqual('cuenta_id', $this->id)
->whereGte('fecha', $t->copy()->subMonthNoOverflow()->startOfMonth()->format('Y-m-d'))
->orderByDesc('fecha')
->count('id');
}
public function hasTransacciones(): bool {
return (bool) Model::factory(Transaccion::class)
->select('transacciones.*')