Fecha cuota
This commit is contained in:
@ -13,6 +13,19 @@ class Pagos
|
||||
{
|
||||
use withJson;
|
||||
|
||||
public function get(ServerRequestInterface $request, ResponseInterface $response, Service\Venta\Pago $pagoService,
|
||||
Service\Format $formatService, int $pago_id): ResponseInterface
|
||||
{
|
||||
$output = [
|
||||
'pago_id' => $pago_id,
|
||||
'pago' => null
|
||||
];
|
||||
try {
|
||||
$output['pago'] = json_decode(json_encode($pagoService->getById($pago_id)), JSON_OBJECT_AS_ARRAY);
|
||||
$output['pago']['valor_uf'] = $formatService->ufs($output['pago']['valor_uf']);
|
||||
} catch (EmptyResult) {}
|
||||
return $this->withJson($response, $output);
|
||||
}
|
||||
public function edit(ServerRequestInterface $request, ResponseInterface $response, Repository\Venta\Pago $pagoRepository, int $pago_id): ResponseInterface
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
@ -31,33 +44,41 @@ class Pagos
|
||||
} catch (EmptyResult) {}
|
||||
return $this->withJson($response, $output);
|
||||
}
|
||||
public function depositar(ServerRequestInterface $request, ResponseInterface $response, Service\Venta\Pago $pagoService, int $pago_id): ResponseInterface
|
||||
public function depositar(ServerRequestInterface $request, ResponseInterface $response,
|
||||
Service\Venta\Pago $pagoService, Service\Format $formatService, int $pago_id): ResponseInterface
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$output = [
|
||||
'pago_id' => $pago_id,
|
||||
'input' => $body,
|
||||
'pago' => null,
|
||||
'depositado' => false
|
||||
];
|
||||
try {
|
||||
$pago = $pagoService->getById($pago_id);
|
||||
$fecha = new DateTimeImmutable($body->fecha);
|
||||
$fecha = new DateTimeImmutable($body['fecha']);
|
||||
$output['depositado'] = $pagoService->depositar($pago, $fecha);
|
||||
$output['pago'] = json_decode(json_encode($pagoService->getById($pago_id)), JSON_OBJECT_AS_ARRAY);
|
||||
$output['pago']['valor_uf'] = $formatService->ufs($output['pago']['valor_uf']);
|
||||
} catch (EmptyResult) {}
|
||||
return $this->withJson($response, $output);
|
||||
}
|
||||
public function abonar(ServerRequestInterface $request, ResponseInterface $response, Service\Venta\Pago $pagoService, int $pago_id): ResponseInterface
|
||||
public function abonar(ServerRequestInterface $request, ResponseInterface $response, Service\Venta\Pago $pagoService,
|
||||
Service\Format $formatService, int $pago_id): ResponseInterface
|
||||
{
|
||||
$body = $request->getParsedBody();
|
||||
$output = [
|
||||
'pago_id' => $pago_id,
|
||||
'input' => $body,
|
||||
'pago' => null,
|
||||
'abonado' => false
|
||||
];
|
||||
try {
|
||||
$pago = $pagoService->getById($pago_id);
|
||||
$fecha = new DateTimeImmutable($body->fecha);
|
||||
$fecha = new DateTimeImmutable($body['fecha']);
|
||||
$output['abonado'] = $pagoService->abonar($pago, $fecha);
|
||||
$output['pago'] = json_decode(json_encode($pagoService->getById($pago_id)), JSON_OBJECT_AS_ARRAY);
|
||||
$output['pago']['valor_uf'] = $formatService->ufs($output['pago']['valor_uf']);
|
||||
$output['input']['fecha'] = $fecha->format('d-m-Y');
|
||||
} catch (EmptyResult) {}
|
||||
return $this->withJson($response, $output);
|
||||
|
@ -98,7 +98,6 @@ class Ventas
|
||||
return $view->render($response, 'ventas.add', compact('regiones', 'proyectos'));
|
||||
}
|
||||
public function cuotas(ServerRequestInterface $request, ResponseInterface $response, Service\Venta $ventaService,
|
||||
Repository\Venta $ventaRepository,
|
||||
View $view, int $venta_id): ResponseInterface
|
||||
{
|
||||
$venta = $ventaService->getById($venta_id);
|
||||
@ -112,6 +111,11 @@ class Ventas
|
||||
$asociadas []= $ventaService->getByPie($asociado->id);
|
||||
}
|
||||
}
|
||||
if (count($venta->formaPago()->pie->asociados()) > 0) {
|
||||
foreach ($venta->formaPago()->pie->asociados() as $asociado) {
|
||||
$asociadas []= $ventaService->getByPie($asociado->id);
|
||||
}
|
||||
}
|
||||
return $view->render($response, 'ventas.pies.cuotas', compact('venta', 'asociadas'));
|
||||
}
|
||||
public function escriturar(ServerRequestInterface $request, ResponseInterface $response, Service\Venta $ventaService,
|
||||
|
Reference in New Issue
Block a user