falta terminar albaranes

This commit is contained in:
2025-04-20 22:10:56 +02:00
parent 61abcb3dbd
commit 19fd76e910
21 changed files with 1731 additions and 464 deletions

View File

@ -19,8 +19,6 @@ class EnvioLineaModel extends Model
'pedido_id',
'unidades_envio',
'unidades_total',
'cajas',
'unidades_cajas',
'created_at',
'updated_at',
'created_by',
@ -37,7 +35,7 @@ class EnvioLineaModel extends Model
$builder = $this->db
->table($this->table . " t1")
->select(
"t1.id, t1.pedido_id as pedido, t3.id as presupuesto,t1.cajas, t1.cajas as cajasRaw,
"t1.id, t1.pedido_id as pedido, t3.id as presupuesto,
t3.titulo as titulo, t1.unidades_envio as unidadesEnvio, t1.unidades_envio as unidadesEnvioRaw,
t1.unidades_total as unidadesTotal,
IFNULL((
@ -62,17 +60,5 @@ class EnvioLineaModel extends Model
return $builder;
}
public function getMaxCaja()
{
$builder = $this->db
->table($this->table . " t1");
$builder->selectMax('CAST(t1.cajas AS UNSIGNED)', 'max_caja');
$builder->where('t1.cajas IS NOT NULL');
$query = $builder->get();
$row = $query->getRow();
$maxCaja = is_numeric($row->max_caja) ? (int) $row->max_caja : 0;
return $maxCaja + 1;
}
}