From 61d8dca58372efb4edf62c0222e31987a8d92028 Mon Sep 17 00:00:00 2001 From: Jaime Jimenez Date: Wed, 2 Jul 2025 11:15:35 +0200 Subject: [PATCH] corregido direcciones borran precio --- ci4/app/Controllers/Presupuestos/Presupuestocliente.php | 6 +++++- .../js/safekat/pages/presupuestoCliente/direcciones.js | 8 ++++++++ .../pages/presupuestoCliente/presupuestoCliente.js | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php index 6423077c..a38e17e4 100755 --- a/ci4/app/Controllers/Presupuestos/Presupuestocliente.php +++ b/ci4/app/Controllers/Presupuestos/Presupuestocliente.php @@ -719,7 +719,11 @@ class Presupuestocliente extends \App\Controllers\BaseResourceController } } - + // Se suma el coste de envĂ­o a cada precio unidad + for ($i = 0; $i < count($tirada); $i++) { + if($return_data['coste_envio'] && isset($return_data['coste_envio'][$i]) && $return_data['coste_envio'][$i] > 0) + $return_data['precio_u'][$i] = round(floatval($return_data['precio_u'][$i]) + $return_data['coste_envio'][$i]/$tirada[$i], 4); + } if ($this->request) { if ($this->request->isAJAX()) diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/direcciones.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/direcciones.js index 6fb5da6a..0378ed6a 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/direcciones.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/direcciones.js @@ -376,6 +376,10 @@ class Direcciones { } } this.#addTarjetaDireccion(this.divDirecciones, this.direcciones, divId, id, unidades, entregaPalets); + + this.calcularPresupuesto = true; + this.divDirecciones.trigger('change'); + } catch (e) { console.error(e); @@ -578,6 +582,10 @@ class Direcciones { this.sameAddPrincipalFP2.trigger('change'); } } + + this.calcularPresupuesto = true; + this.divDirecciones.trigger('change'); + } #deleteDireccionFP(event, num_ferroPrototipo = 1) { diff --git a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js index c98fd81f..c9cfc5bf 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoCliente/presupuestoCliente.js @@ -851,7 +851,7 @@ class PresupuestoCliente { self.direcciones.cargarDatos(response.data.direcciones, response.data.datosGenerales, (response.data.direccionesFerroPrototipo && response.data.direccionesFerroPrototipo.length > 0) ? response.data.direccionesFerroPrototipo : [] , - response.data.direccionesFPChecks ? JSON.parse(response.data.direccionesFPChecks) : {} + response.data.direccionesFPChecks && response.data.direccionesFPChecks.length > 0 ? JSON.parse(response.data.direccionesFPChecks) : {} ); try {