Merge branch 'develop' into feature/cierres
This commit is contained in:
@ -45,6 +45,8 @@ abstract class Repository implements Define\Repository
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param int $id
|
||||||
|
* @return Define\Model
|
||||||
* @throws EmptyResult
|
* @throws EmptyResult
|
||||||
*/
|
*/
|
||||||
public function fetchById(int $id): Define\Model
|
public function fetchById(int $id): Define\Model
|
||||||
|
|||||||
@ -54,6 +54,11 @@ class Movimiento extends Ideal\Repository
|
|||||||
return $this->update($model, ['cuenta_id', 'fecha', 'glosa', 'documento', 'cargo', 'abono', 'saldo'], $new_data);
|
return $this->update($model, ['cuenta_id', 'fecha', 'glosa', 'documento', 'cargo', 'abono', 'saldo'], $new_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $cuenta_id
|
||||||
|
* @return array
|
||||||
|
* @throws Implement\Exception\EmptyResult
|
||||||
|
*/
|
||||||
public function fetchByCuenta(int $cuenta_id): array
|
public function fetchByCuenta(int $cuenta_id): array
|
||||||
{
|
{
|
||||||
$query = $this->connection->getQueryBuilder()
|
$query = $this->connection->getQueryBuilder()
|
||||||
@ -97,6 +102,13 @@ class Movimiento extends Ideal\Repository
|
|||||||
->where("cuenta_id = ? AND fecha = ? AND SUBSTRING(LOWER(LTRIM(glosa)), 0, {$len}) = SUBSTRING(LOWER(LTRIM(?)), 0, {$len}) AND cargo = ? AND abono = ? AND saldo = ?");
|
->where("cuenta_id = ? AND fecha = ? AND SUBSTRING(LOWER(LTRIM(glosa)), 0, {$len}) = SUBSTRING(LOWER(LTRIM(?)), 0, {$len}) AND cargo = ? AND abono = ? AND saldo = ?");
|
||||||
return $this->fetchOne($query, [$cuenta_id, $fecha->format('Y-m-d'), $glosa, $cargo, $abono, $saldo]);
|
return $this->fetchOne($query, [$cuenta_id, $fecha->format('Y-m-d'), $glosa, $cargo, $abono, $saldo]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $start
|
||||||
|
* @param int $amount
|
||||||
|
* @return array
|
||||||
|
* @throws Implement\Exception\EmptyResult
|
||||||
|
*/
|
||||||
public function fetchAmountStartingFrom(int $start, int $amount): array
|
public function fetchAmountStartingFrom(int $start, int $amount): array
|
||||||
{
|
{
|
||||||
$query = $this->connection->getQueryBuilder()
|
$query = $this->connection->getQueryBuilder()
|
||||||
@ -105,6 +117,14 @@ class Movimiento extends Ideal\Repository
|
|||||||
->limit($amount, $start);
|
->limit($amount, $start);
|
||||||
return $this->fetchMany($query);
|
return $this->fetchMany($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $sociedad_rut
|
||||||
|
* @param DateTimeInterface $mes
|
||||||
|
* @param int|null $amount
|
||||||
|
* @return array
|
||||||
|
* @throws Implement\Exception\EmptyResult
|
||||||
|
*/
|
||||||
public function fetchAmountBySociedadAndMes(int $sociedad_rut, DateTimeInterface $mes, ?int $amount): array
|
public function fetchAmountBySociedadAndMes(int $sociedad_rut, DateTimeInterface $mes, ?int $amount): array
|
||||||
{
|
{
|
||||||
$query = $this->connection->getQueryBuilder()
|
$query = $this->connection->getQueryBuilder()
|
||||||
|
|||||||
@ -19,10 +19,13 @@ class Proveedor extends Ideal\Repository
|
|||||||
|
|
||||||
public function create(?array $data = null): Model\Inmobiliaria\Proveedor
|
public function create(?array $data = null): Model\Inmobiliaria\Proveedor
|
||||||
{
|
{
|
||||||
$map = (new Implement\Repository\MapperParser(['rut', 'digito', 'nombre', 'razon']))
|
$map = new Implement\Repository\MapperParser(['rut', 'digito', 'nombre', 'razon'])
|
||||||
->register('contacto_rut', (new Implement\Repository\Mapper())
|
->register('contacto_rut', (new Implement\Repository\Mapper())
|
||||||
->setProperty('contacto')
|
->setProperty('contacto')
|
||||||
->setFunction(function($data) {
|
->setFunction(function($data) {
|
||||||
|
if ($data['contacto_rut'] === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return $this->personaService->getById($data['contacto_rut']);
|
return $this->personaService->getById($data['contacto_rut']);
|
||||||
})
|
})
|
||||||
->setDefault(null));
|
->setDefault(null));
|
||||||
|
|||||||
Reference in New Issue
Block a user