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

@ -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();
}