Proveedores en movimientos

This commit is contained in:
Juan Pablo Vial
2024-12-03 20:32:29 -03:00
parent 0766cf7e94
commit fe74619482
16 changed files with 158 additions and 286 deletions

View File

@ -2,8 +2,10 @@
namespace Incoviba\Service\Contabilidad;
use DateTimeInterface;
use Incoviba\Common\Define;
use Incoviba\Common\Ideal\Service;
use Incoviba\Common\Implement;
use Incoviba\Common\Implement\Exception\EmptyResult;
use Incoviba\Model;
use Incoviba\Repository;
use Psr\Log\LoggerInterface;
@ -13,7 +15,7 @@ class Movimiento extends Service
public function __construct(LoggerInterface $logger,
protected Repository\Contabilidad\Movimiento $movimientoRepository,
protected Repository\Contabilidad\Movimiento\Detalle $detalleRepository,
protected Movimiento\Auxiliar $auxiliarService)
protected Movimiento\Detalle $detalleService)
{
parent::__construct($logger);
}
@ -76,12 +78,20 @@ class Movimiento extends Service
$this->movimientoRepository->remove($movimiento);
}
/**
* @throws EmptyResult
*/
public function findRut(int $rut): Define\Model
{
return $this->detalleService->findRut($rut);
}
public function process(Model\Contabilidad\Movimiento $movimiento): Model\Contabilidad\Movimiento
{
$movimiento->addFactory('detalles', (new Implement\Repository\Factory())
->setCallable(function(int $movimiento_id) {
try {
return $this->detalleRepository->fetchByMovimiento($movimiento_id);
return $this->detalleService->getByMovimiento($movimiento_id);
} catch (Implement\Exception\EmptyResult) {
return null;
}