feature/cierres #25

Open
aldarien wants to merge 446 commits from feature/cierres into develop
329 changed files with 1040 additions and 13304 deletions
Showing only changes of commit c34048a53a - Show all commits

View File

@ -9,6 +9,7 @@ use Incoviba\Common\Ideal\Controller;
use Incoviba\Common\Implement\Exception\EmptyRedis;
use Incoviba\Common\Implement\Exception\EmptyResult;
use Incoviba\Controller\withRedis;
use Incoviba\Exception\ServiceAction\Read;
use Incoviba\Model;
use Incoviba\Repository;
use Incoviba\Service;
@ -368,4 +369,23 @@ class Ventas extends Controller
} catch (EmptyResult) {}
return $this->withJson($response, $output);
}
public function byUnidades(ServerRequestInterface $request, ResponseInterface $response,
Service\Venta $ventaService, Service\Venta\Unidad $unidadService): ResponseInterface
{
$input = $request->getParsedBody();
$output = [
'input' => $input,
'ventas' => []
];
foreach ($input['unidad_ids'] as $unidad_id) {
try {
$venta = $ventaService->getByUnidadId($unidad_id);
$output['ventas'][] = [
'unidad_id' => $unidad_id,
'venta' => $venta
];
} catch (Read) {}
}
return $this->withJson($response, $output);
}
}