Listado proyectos
This commit is contained in:
@ -4,11 +4,13 @@ namespace Incoviba\Controller\API\Ventas;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Incoviba\Common\Implement\Exception\EmptyResult;
|
||||
use Incoviba\Controller\API\withJson;
|
||||
use Incoviba\Repository;
|
||||
use Incoviba\Service;
|
||||
|
||||
class Cierres
|
||||
{
|
||||
use withJson;
|
||||
public function proyecto(ServerRequestInterface $request, ResponseInterface $response, Service\Venta\Cierre $service): ResponseInterface
|
||||
{
|
||||
$body = $request->getBody();
|
||||
@ -20,8 +22,7 @@ class Cierres
|
||||
$output['cierres'] = $cierres;
|
||||
$output['total'] = count($cierres);
|
||||
} catch (EmptyResult) {}
|
||||
$response->getBody()->write(json_encode($output));
|
||||
return $response->withHeader('Content-Type', 'application/json');
|
||||
return $this->withJson($response, $output);
|
||||
}
|
||||
public function vigentes(ServerRequestInterface $request, ResponseInterface $response, Repository\Venta\Cierre $cierreRepository): ResponseInterface
|
||||
{
|
||||
@ -49,7 +50,6 @@ class Cierres
|
||||
$output[$row['Proyecto']][$estado] += $row['Cantidad'];
|
||||
$output[$row['Proyecto']]['total'] += $row['Cantidad'];
|
||||
}
|
||||
$response->getBody()->write(json_encode(['cierres' => $output]));
|
||||
return $response->withHeader('Content-Type', 'application/json');
|
||||
return $this->withJson($response, ['cierres' => $output]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user