Facturacion
This commit is contained in:
@ -2,9 +2,9 @@
|
||||
namespace Incoviba\Controller\API;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use Incoviba\Common\Implement\Exception\EmptyRedis;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Incoviba\Common\Implement\Exception\EmptyRedis;
|
||||
use Incoviba\Common\Implement\Exception\EmptyResult;
|
||||
use Incoviba\Model;
|
||||
use Incoviba\Repository;
|
||||
@ -153,4 +153,21 @@ class Ventas
|
||||
}
|
||||
return $this->withJson($response, $output);
|
||||
}
|
||||
public function unidades(ServerRequestInterface $request, ResponseInterface $response, Service\Venta\Unidad $unidadService, int $venta_id): ResponseInterface
|
||||
{
|
||||
$output = [
|
||||
'venta_id' => $venta_id,
|
||||
'unidades' => []
|
||||
];
|
||||
try {
|
||||
$unidades = $unidadService->getByVenta($venta_id);
|
||||
$output['unidades'] = json_decode(json_encode($unidades));
|
||||
array_walk($output['unidades'], function($unidad, $index, $unidades) {
|
||||
$unidad->prorrateo = $unidades[$index]->prorrateo;
|
||||
$unidad->precios = $unidades[$index]->precios;
|
||||
$unidad->current_precio = $unidades[$index]->currentPrecio;
|
||||
}, $unidades);
|
||||
} catch (EmptyResult) {}
|
||||
return $this->withJson($response, $output);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user