FIX: Pie cuotas vigentes
This commit is contained in:
@ -20,7 +20,6 @@ class Pies
|
||||
'input' => $body,
|
||||
'edited' => false
|
||||
];
|
||||
error_log(var_export($output,true).PHP_EOL,3,'/logs/pies');
|
||||
try {
|
||||
$pie = $pieService->getById($pie_id);
|
||||
$pieService->edit($pie, (array) $body);
|
||||
|
@ -83,13 +83,14 @@ class Cuotas
|
||||
});
|
||||
return $view->render($response, 'ventas.pies.cuotas.add', compact('pie', 'venta', 'bancos'));
|
||||
}
|
||||
public function doAdd(ServerRequestInterface $request, ResponseInterface $response, Service\Venta\Pie $pieService, Repository\Venta $ventaRepository, int $pie_id): ResponseInterface
|
||||
public function doAdd(ServerRequestInterface $request, ResponseInterface $response, Service\Venta\Pie $pieService,
|
||||
Repository\Venta $ventaRepository, int $pie_id): ResponseInterface
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$pie = $pieService->getById($pie_id);
|
||||
$venta = $ventaRepository->fetchByPie($pie_id);
|
||||
$total = $pie->cuotas - count($pie->cuotas());
|
||||
$start = count($pie->cuotas());
|
||||
$start = count($pie->cuotas(vigentes: true));
|
||||
$total = $pie->cuotas;
|
||||
for ($i = $start; $i < $total; $i ++) {
|
||||
$data = [
|
||||
'pie' => $pie->id,
|
||||
|
@ -27,9 +27,9 @@ class Cuota extends Model
|
||||
'valor' => $this->valor,
|
||||
'estado' => $this->estado ?? false,
|
||||
'banco' => $this->banco,
|
||||
'fecha_pago' => $this->fechaPago->format('Y-m-d H:i:s') ?? '',
|
||||
'fecha_pago' => $this->fechaPago?->format('Y-m-d H:i:s') ?? '',
|
||||
'abonado' => $this->abonado ?? false,
|
||||
'fecha_abonado' => $this->fechaAbonado->format('Y-m-d H:i:s') ?? '',
|
||||
'fecha_abonado' => $this->fechaAbonado?->format('Y-m-d H:i:s') ?? '',
|
||||
'uf' => $this->uf ?? 1,
|
||||
'pago' => $this->pago ?? '',
|
||||
'numero' => $this->numero ?? ''
|
||||
|
@ -29,7 +29,7 @@ class Pie extends Model
|
||||
});
|
||||
}
|
||||
return array_filter($this->cuotasArray, function(Cuota $cuota) {
|
||||
return $cuota->pago->currentEstado->tipoEstadoPago->active === 1;
|
||||
return $cuota->pago->currentEstado->tipoEstadoPago->activo or $cuota->pago->currentEstado->tipoEstadoPago->descripcion === 'devuelto';
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -400,7 +400,6 @@ class Venta
|
||||
$pago = $venta->resciliacion();
|
||||
$this->pagoService->delete($pago);
|
||||
$estado = $venta->currentEstado();
|
||||
error_log(var_export($estado,true));
|
||||
$this->estadoVentaRepository->remove($estado);
|
||||
$this->ventaRepository->edit($venta, ['resciliacion' => null]);
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user