FormaPago Service

This commit is contained in:
Juan Pablo Vial
2024-03-13 14:38:44 -03:00
parent c7dd309185
commit 98953cce42
21 changed files with 261 additions and 71 deletions

View File

@ -38,7 +38,7 @@ class Venta extends Ideal\Repository
->setFactory((new Implement\Repository\Factory())
->setCallable([$this->propiedadRepository, 'fetchById'])
->setArgs([$data['propiedad']])))
->register('pie', (new Implement\Repository\Mapper())
/*->register('pie', (new Implement\Repository\Mapper())
->setProperty('formaPago')
->setFactory((new Implement\Repository\Factory())
->setCallable(function($repositories, $data) {
@ -84,7 +84,7 @@ class Venta extends Ideal\Repository
'escrituraRepository' => $this->escrituraRepository,
'subsidioRepository' => $this->subsidioRepository,
'pagoService' => $this->pagoService
], $data])))
], $data])))*/
/*->register('escriturado', (new Implement\Repository\Mapper())
->setFunction(function($data) {
return $data['escritura'] !== null;

View File

@ -52,4 +52,13 @@ class BonoPie extends Ideal\Repository
->where('pago = ?');
return $this->fetchOne($query, [$pago_id]);
}
public function fetchByVenta(int $venta_id): Model\Venta\BonoPie
{
$query = $this->connection->getQueryBuilder()
->select('a.*')
->from("{$this->getTable()} a")
->joined('JOIN venta ON venta.bono_pie = a.id')
->where('venta.id = ?');
return $this->fetchOne($query, [$venta_id]);
}
}

View File

@ -53,4 +53,13 @@ class Credito extends Ideal\Repository
->where('pago = ?');
return $this->fetchOne($query, [$pago_id]);
}
public function fetchByVenta(int $venta_id): Model\Venta\Credito
{
$query = $this->connection->getQueryBuilder()
->select('a.*')
->from("{$this->getTable()} a")
->joined('JOIN venta ON venta.credito = a.id')
->where('venta.id = ?');
return $this->fetchOne($query, [$venta_id]);
}
}

View File

@ -55,4 +55,13 @@ class Escritura extends Ideal\Repository
->where('pago = ?');
return $this->fetchOne($query, [$pago_id]);
}
public function fetchByVenta(int $venta_id): Model\Venta\Escritura
{
$query = $this->connection->getQueryBuilder()
->select('a.*')
->from("{$this->getTable()} a")
->joined('JOIN venta ON venta.escritura = a.id')
->where('venta.id = ?');
return $this->fetchOne($query, [$venta_id]);
}
}

View File

@ -108,4 +108,13 @@ WHERE venta_id = ?";
->where('valor = ? OR ROUND(valor/uf, 3) = ?');
return $this->fetchMany($query, [$value, $value]);
}
public function fetchDevolucionByVenta(int $venta_id): Model\Venta\Pago
{
$query = $this->connection->getQueryBuilder()
->select('a.*')
->from("{$this->getTable()} a")
->joined('JOIN venta ON venta.devolucion = a.id')
->where('venta.id = ?');
return $this->fetchOne($query, [$venta_id]);
}
}

View File

@ -72,4 +72,13 @@ class Pie extends Ideal\Repository
->where('reajuste = ?');
return $this->fetchOne($query, [$reajuste_id]);
}
public function fetchByVenta(int $venta_id): Model\Venta\Pie
{
$query = $this->connection->getQueryBuilder()
->select('a.*')
->from("{$this->getTable()} a")
->joined('JOIN venta ON venta.pie = a.id')
->where('venta.id = ?');
return $this->fetchOne($query, [$venta_id]);
}
}

View File

@ -49,4 +49,13 @@ class Subsidio extends Ideal\Repository
->where('subsidio = ? OR pago = ?');
return $this->fetchOne($query, [$pago_id, $pago_id]);
}
public function fetchByVenta(int $venta_id): Model\Venta\Subsidio
{
$query = $this->connection->getQueryBuilder()
->select('a.*')
->from("{$this->getTable()} a")
->joined('JOIN venta ON venta.subsidio = a.id')
->where('venta.id = ?');
return $this->fetchOne($query, [$venta_id]);
}
}