COrregidos cambios JM

This commit is contained in:
Ignacio Martinez Navajas
2025-06-04 23:27:31 +02:00
parent 7f88ea7296
commit 63866b6f2f
5 changed files with 40 additions and 32 deletions

View File

@ -132,7 +132,16 @@ class ImportadorModel extends \App\Models\BaseModel
$db = \Config\Database::connect($this->DBGroup);
$builder = $db->table('pedido_libro t1')
->select('t1.id, t1.created_at, t1.titulo, t1.paginas, t1.tirada, t1.total, t1.estado');
->select(
't1.id,
t1.created_at,
t1.tirada,
(CASE
WHEN t1.tirada > 0 THEN t1.total / t1.tirada
ELSE 0
END) AS precio_ud,
t1.total,
t1.estado');
if ($catalogoId !== null) {
$builder->where('t1.catalogo_id', $catalogoId);