Agregar Pie
This commit is contained in:
@ -4,6 +4,7 @@ namespace Incoviba\Service;
|
||||
use Exception;
|
||||
use DateTimeImmutable;
|
||||
use DateMalformedStringException;
|
||||
use Incoviba\Exception\ServiceAction\{Read, Update};
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Incoviba\Common\Ideal\Service;
|
||||
use Incoviba\Common\Implement;
|
||||
@ -36,9 +37,18 @@ class Venta extends Service
|
||||
parent::__construct($logger);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $venta_id
|
||||
* @return Model\Venta
|
||||
* @throws Read
|
||||
*/
|
||||
public function getById(int $venta_id): Model\Venta
|
||||
{
|
||||
return $this->process($this->ventaRepository->fetchById($venta_id));
|
||||
try {
|
||||
return $this->process($this->ventaRepository->fetchById($venta_id));
|
||||
} catch (Implement\Exception\EmptyResult $exception) {
|
||||
throw new Read(__CLASS__, $exception);
|
||||
}
|
||||
}
|
||||
public function getByProyecto(int $proyecto_id): array
|
||||
{
|
||||
@ -285,6 +295,22 @@ class Venta extends Service
|
||||
return $this->formaPagoService->add($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Model\Venta $venta
|
||||
* @param array $data
|
||||
* @return Model\Venta
|
||||
* @throws Update
|
||||
*/
|
||||
public function edit(Model\Venta $venta, array $data): Model\Venta
|
||||
{
|
||||
try {
|
||||
$filteredData = $this->ventaRepository->filterData($data);
|
||||
return $this->ventaRepository->edit($venta, $filteredData);
|
||||
} catch (Implement\Exception\EmptyResult $exception) {
|
||||
throw new Update(__CLASS__, $exception);
|
||||
}
|
||||
}
|
||||
|
||||
protected function addEstado(Model\Venta $venta, Model\Venta\TipoEstadoVenta $tipoEstadoVenta, array $data): void
|
||||
{
|
||||
try {
|
||||
|
Reference in New Issue
Block a user