Editar estado cuota
This commit is contained in:
@ -57,6 +57,31 @@ class Pagos
|
||||
} catch (EmptyResult) {}
|
||||
return $this->withJson($response, $output);
|
||||
}
|
||||
public function estado(ServerRequestInterface $request, ResponseInterface $response,
|
||||
Service\Venta\Pago $pagoService,
|
||||
Repository\Venta\EstadoPago $estadoPagoRepository,
|
||||
int $pago_id): ResponseInterface
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$output = [
|
||||
'pago_id' => $pago_id,
|
||||
'input' => $body,
|
||||
'pago' => null,
|
||||
'editado' => false
|
||||
];
|
||||
try {
|
||||
$pago = $pagoService->getById($pago_id);
|
||||
$output['pago'] = $pago;
|
||||
$estado = $estadoPagoRepository->create([
|
||||
'pago' => $pago->id,
|
||||
'estado' => $body['estado'],
|
||||
'fecha' => $body['fecha']
|
||||
]);
|
||||
$estadoPagoRepository->save($estado);
|
||||
$output['editado'] = true;
|
||||
} catch (EmptyResult) {}
|
||||
return $this->withJson($response, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ServerRequestInterface $request
|
||||
|
@ -99,6 +99,7 @@ class Ventas
|
||||
}
|
||||
public function cuotas(ServerRequestInterface $request, ResponseInterface $response, Service\Venta $ventaService,
|
||||
Service\Contabilidad\Banco $bancoService,
|
||||
Repository\Venta\TipoEstadoPago $tipoEstadoPagoRepository,
|
||||
View $view, int $venta_id): ResponseInterface
|
||||
{
|
||||
$venta = $ventaService->getById($venta_id);
|
||||
@ -120,11 +121,9 @@ class Ventas
|
||||
$asociadas []= $ventaService->getByPie($asociado->id);
|
||||
}
|
||||
}
|
||||
$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'));
|
||||
$bancos = $bancoService->getAll('nombre');
|
||||
$estados = $tipoEstadoPagoRepository->fetchAll('descripcion');
|
||||
return $view->render($response, 'ventas.pies.cuotas', compact('venta', 'asociadas', 'bancos', 'estados'));
|
||||
}
|
||||
public function escriturar(ServerRequestInterface $request, ResponseInterface $response, Service\Venta $ventaService,
|
||||
Repository\Contabilidad\Banco $bancoRepository, View $view, int $venta_id): ResponseInterface
|
||||
|
@ -12,14 +12,13 @@ class Pies
|
||||
{
|
||||
public function cuotas(ServerRequestInterface $request, ResponseInterface $response, Service\Venta\Pie $pieService,
|
||||
Repository\Venta $ventaRepository, Repository\Contabilidad\Banco $bancoRepository,
|
||||
Repository\Venta\TipoEstadoPago $tipoEstadoPagoRepository,
|
||||
View $view, int $pie_id): ResponseInterface
|
||||
{
|
||||
$pie = $pieService->getById($pie_id);
|
||||
$venta = $ventaRepository->fetchByPie($pie_id);
|
||||
$bancos = $bancoRepository->fetchAll();
|
||||
usort($bancos, function(Model\Contabilidad\Banco $a, Model\Contabilidad\Banco $b) {
|
||||
return strcmp($a->nombre, $b->nombre);
|
||||
});
|
||||
return $view->render($response, 'ventas.pies.cuotas', compact('pie', 'venta', 'bancos', 'ventaRepository'));
|
||||
$bancos = $bancoRepository->fetchAll('nombre');
|
||||
$estados = $tipoEstadoPagoRepository->fetchAll('descripcion');
|
||||
return $view->render($response, 'ventas.pies.cuotas', compact('pie', 'venta', 'bancos', 'estados', 'ventaRepository'));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user