Informe Tesoreria
This commit is contained in:
@ -49,6 +49,14 @@ class Cartola extends Ideal\Repository
|
||||
return $this->update($model, ['cuenta_id', 'fecha', 'cargos', 'abonos', 'saldo'], $new_data);
|
||||
}
|
||||
|
||||
public function fetchByFecha(DateTimeInterface $fecha): array
|
||||
{
|
||||
$query = $this->connection->getQueryBuilder()
|
||||
->select()
|
||||
->from($this->getTable())
|
||||
->where('fecha = ?');
|
||||
return $this->fetchMany($query, [$fecha->format('Y-m-d')]);
|
||||
}
|
||||
public function fetchByCuentaAndFecha(int $cuenta_id, DateTimeInterface $fecha): Model\Cartola
|
||||
{
|
||||
$query = $this->connection->getQueryBuilder()
|
||||
|
@ -7,7 +7,7 @@ use Incoviba\Common\Implement;
|
||||
use Incoviba\Repository;
|
||||
use Incoviba\Model;
|
||||
|
||||
class DAP extends Ideal\Repository
|
||||
class Deposito extends Ideal\Repository
|
||||
{
|
||||
public function __construct(Define\Connection $connection, protected Repository\Inmobiliaria\Cuenta $cuentaRepository)
|
||||
{
|
||||
@ -15,9 +15,9 @@ class DAP extends Ideal\Repository
|
||||
$this->setTable('depositos');
|
||||
}
|
||||
|
||||
public function create(?array $data = null): Model\DAP
|
||||
public function create(?array $data = null): Model\Deposito
|
||||
{
|
||||
$map = (new Implement\Repository\MapperParser(['capital', 'futuro']))
|
||||
$map = (new Implement\Repository\MapperParser(['id', 'capital', 'futuro']))
|
||||
->register('cuenta_id', (new Implement\Repository\Mapper())
|
||||
->setProperty('cuenta')
|
||||
->setFunction(function(array $data) {
|
||||
@ -25,20 +25,20 @@ class DAP extends Ideal\Repository
|
||||
}))
|
||||
->register('inicio', new Implement\Repository\Mapper\DateTime('inicio'))
|
||||
->register('termino', new Implement\Repository\Mapper\DateTime('termino'));
|
||||
return $this->parseData(new Model\DAP(), $data, $map);
|
||||
return $this->parseData(new Model\Deposito(), $data, $map);
|
||||
}
|
||||
public function save(Define\Model $model): Model\DAP
|
||||
public function save(Define\Model $model): Model\Deposito
|
||||
{
|
||||
$model->id = $this->saveNew([
|
||||
'cuenta_id', 'capital', 'futuro', 'inicio', 'termino'
|
||||
$this->saveNew([
|
||||
'id', 'cuenta_id', 'capital', 'futuro', 'inicio', 'termino'
|
||||
], [
|
||||
$model->cuenta->id, $model->capital, $model->futuro,
|
||||
$model->id, $model->cuenta->id, $model->capital, $model->futuro,
|
||||
$model->inicio->format('Y-m-d'), $model->termino->format('Y-m-d')
|
||||
]);
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function edit(Define\Model $model, array $new_data): Model\DAP
|
||||
public function edit(Define\Model $model, array $new_data): Model\Deposito
|
||||
{
|
||||
return $this->update($model, ['cuenta_id', 'capital', 'futuro', 'inicio', 'termino'], $new_data);
|
||||
}
|
||||
@ -51,4 +51,4 @@ class DAP extends Ideal\Repository
|
||||
->where('cuenta_id = ?');
|
||||
return $this->fetchMany($query, [$cuenta_id]);
|
||||
}
|
||||
}
|
||||
}
|
@ -53,6 +53,14 @@ class Movimiento extends Ideal\Repository
|
||||
return $this->update($model, ['cuenta_id', 'fecha', 'glosa', 'documento', 'cargo', 'abono', 'saldo'], $new_data);
|
||||
}
|
||||
|
||||
public function fetchByCuentaAndFecha(int $cuenta_id, DateTimeInterface $fecha): array
|
||||
{
|
||||
$query = $this->connection->getQueryBuilder()
|
||||
->select()
|
||||
->from($this->getTable())
|
||||
->where('cuenta_id = ? AND fecha = ?');
|
||||
return $this->fetchMany($query, [$cuenta_id, $fecha->format('Y-m-d')]);
|
||||
}
|
||||
public function fetchByCuentaAndFechaAndMonto(int $cuenta_id, DateTimeInterface $fecha, int $monto): Model\Movimiento
|
||||
{
|
||||
$query = $this->connection->getQueryBuilder()
|
||||
|
Reference in New Issue
Block a user