Editar cuota

This commit is contained in:
Juan Pablo Vial
2024-10-23 08:39:11 -03:00
parent fe6a01b2fb
commit 389e60980e
5 changed files with 233 additions and 4 deletions

View File

@ -43,7 +43,8 @@ class Pagos
$output = [
'input' => $body,
'pago_id' => $pago_id,
'pago' => null
'pago' => null,
'editado' => false
];
try {
$pago = $pagoRepository->fetchById($pago_id);
@ -52,6 +53,7 @@ class Pagos
$body['fecha'] = $fecha->format('Y-m-d');
}
$output['pago'] = $pagoRepository->edit($pago, $body);
$output['editado'] = true;
} catch (EmptyResult) {}
return $this->withJson($response, $output);
}

View File

@ -98,6 +98,7 @@ class Ventas
return $view->render($response, 'ventas.add', compact('regiones', 'proyectos'));
}
public function cuotas(ServerRequestInterface $request, ResponseInterface $response, Service\Venta $ventaService,
Service\Contabilidad\Banco $bancoService,
View $view, int $venta_id): ResponseInterface
{
$venta = $ventaService->getById($venta_id);
@ -119,7 +120,11 @@ class Ventas
$asociadas []= $ventaService->getByPie($asociado->id);
}
}
return $view->render($response, 'ventas.pies.cuotas', compact('venta', 'asociadas'));
$bancos = $bancoService->getAll();
usort($bancos, function($a, $b) {
return strcmp($a->nombre, $b->nombre);
});
return $view->render($response, 'ventas.pies.cuotas', compact('venta', 'asociadas', 'bancos'));
}
public function escriturar(ServerRequestInterface $request, ResponseInterface $response, Service\Venta $ventaService,
Repository\Contabilidad\Banco $bancoRepository, View $view, int $venta_id): ResponseInterface