Merge branch 'main' into mod/importe_fijo_margen

This commit is contained in:
2025-05-06 12:28:58 +02:00
6 changed files with 87 additions and 55 deletions

View File

@ -13,20 +13,22 @@ class PapelImpresionModel extends \App\Models\BaseModel
protected $useAutoIncrement = true;
const SORTABLE = [
0 => "t1.nombre",
1 => "t2.nombre",
2 => "t1.gramaje",
3 => "t1.interior",
4 => "t1.bn",
5 => "t1.color",
6 => "t1.cubierta",
7 => "t1.use_for_tapa_dura",
8 => "t1.sobrecubierta",
9 => "t1.guardas",
10 => "t1.inkjet",
11 => "t1.rotativa",
12 => "t1.isActivo",
13 => "t1.use_in_client",
0 => "t1.id",
1 => "t1.nombre",
2 => "t2.nombre",
3 => "t1.gramaje",
4 => "t1.interior",
5 => "t1.bn",
6 => "t1.color",
7 => "t1.cubierta",
8 => "t1.use_for_tapa_dura",
9 => "t1.sobrecubierta",
10 => "t1.guardas",
11 => "t1.inkjet",
12 => "t1.rotativa",
13 => "t1.isActivo",
14 => "t1.use_in_client",
15 => "t1.precio_tonelada",
];
@ -173,7 +175,7 @@ class PapelImpresionModel extends \App\Models\BaseModel
->groupStart()
->like("t1.nombre", $search)
->orLike("t1.gramaje", $search)
->orLike("t1.nombre", $search)
->orLike("t1.precio_tonelada", $search)
->orLike("t1.gramaje", $search)
->orLike("t2.nombre", $search)
->groupEnd();

View File

@ -271,7 +271,7 @@ class PresupuestoModel extends \App\Models\BaseModel
t1.total_presupuesto AS total_presupuesto, t1.total_presupuesto AS total_presupuesto, t6.estado AS estado"
);
$builder->join("clientes t2", "t1.cliente_id = t2.id", "left");
$builder->join("users t3", "t1.user_update_id = t3.id", "left");
$builder->join("users t3", "t2.comercial_id = t3.id", "left");
$builder->join("lg_paises t5", "t1.pais_id = t5.id", "left");
$builder->join("presupuesto_estados t6", "t1.estado_id = t6.id", "left");
@ -508,15 +508,18 @@ class PresupuestoModel extends \App\Models\BaseModel
'excluir_rotativa' => $excluir_rotativa,
];
/* Actualizacion */
if ($id != 0) {
$fields['id'] = $id;
$fields['updated_at'] = date('Y-m-d H:i:s', now());
}
if ($id != 0) {
$fields['user_update_id'] = auth()->id();
$this->db->table($this->table)->where('id', $id)->update($fields);
return $id;
} else {
}
/* Inserccion */
else {
$fields['user_created_id'] = auth()->id();
$fields['user_update_id'] = auth()->id();
$this->db->table($this->table)->insert($fields);
return $this->db->insertID();
}