2023-08-08 23:53:49 -04:00
|
|
|
<?php
|
|
|
|
namespace Incoviba\Service\Venta;
|
|
|
|
|
|
|
|
use Incoviba\Repository;
|
|
|
|
use Incoviba\Model;
|
|
|
|
|
|
|
|
class Pie
|
|
|
|
{
|
|
|
|
public function __construct(
|
|
|
|
protected Repository\Venta\Pie $pieRepository,
|
2023-09-13 18:51:46 -03:00
|
|
|
protected Cuota $cuotaService
|
2023-08-08 23:53:49 -04:00
|
|
|
) {}
|
|
|
|
|
|
|
|
public function getById(int $pie_id): Model\Venta\Pie
|
|
|
|
{
|
|
|
|
$pie = $this->pieRepository->fetchById($pie_id);
|
2023-09-13 18:51:46 -03:00
|
|
|
$pie->cuotasArray = $this->cuotaService->getVigenteByPie($pie_id);
|
2023-08-08 23:53:49 -04:00
|
|
|
return $pie;
|
|
|
|
}
|
2023-09-13 18:51:46 -03:00
|
|
|
|
|
|
|
public function add(array $data): Model\Venta\Pie
|
|
|
|
{
|
|
|
|
$pie = $this->pieRepository->create($data);
|
|
|
|
return $this->pieRepository->save($pie);
|
|
|
|
}
|
|
|
|
public function addCuota(array $data): Model\Venta\Cuota
|
|
|
|
{
|
|
|
|
return $this->cuotaService->add($data);
|
|
|
|
}
|
2023-08-08 23:53:49 -04:00
|
|
|
}
|