From 343899013f64cf6d3cc30f68ab08c3e813617e06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Mon, 10 Feb 2025 19:48:35 +0100 Subject: [PATCH 1/2] error en faja.getVal(). error en gramaje guardas --- .../presupuestoAdmin/sections/comparador.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js index 7c249f61..a9a973a6 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/comparador.js @@ -208,7 +208,7 @@ class Comparador { '/presupuestoadmin/papelgramaje', 'Seleccione gramaje', false, { [this.csrf_token]: this.csrf_hash, - papel_generico: () => this.papelCubierta.getVal(), + papel_generico: () => this.papelGuardas.getVal(), tipo_impresion: this.tipo_impresion_id, tirada: () => $('#tirada').val(), ancho: () => this.getDimensionLibro().ancho, @@ -1166,11 +1166,11 @@ class Comparador { } else if (uso == 'faja') { - if ((this.papelFaja.getVal() == 0 || this.papelFaja.getVal() == null) && this.faja.getVal()>0 && !this.cargando) { + if (this.papelFaja.getText() == "" && this.faja.val()>0 && !this.cargando) { popErrorAlert(window.language.Presupuestos.errores.seleccionePapel, 'divAlarmasComparador'); return { error: true, data: {} }; } - if ((this.gramajeFaja.getVal() == 0 || this.gramajeFaja.getVal() == null) && this.faja.getVal()>0 && !this.cargando) { + if (this.gramajeFaja.getText() == "" && this.faja.val()>0 && !this.cargando) { popErrorAlert(window.language.Presupuestos.errores.seleccioneGramaje, 'divAlarmasComparador'); return { error: true, data: {} }; } @@ -1413,13 +1413,13 @@ class Comparador { } }, (error) => { - console.log(error); + console.error(error); self.comparadorPlanaRunning = false; } ).post(); } } catch (e) { - console.log(e); + console.error(e); this.comparadorPlanaRunning = false; } } @@ -1507,13 +1507,13 @@ class Comparador { self.comparadorExterioresRunning = false; }, (error) => { - console.log(error); + console.error(error); self.comparadorExterioresRunning = false; } ).post(); } catch (e) { - console.log(e); + console.error(e); self.comparadorExterioresRunning = false; } } @@ -1574,14 +1574,14 @@ class Comparador { self.comparadorFajaRunning = false; }, (error) => { - console.log(error); + console.error(error); self.comparadorFajaRunning = false; } ).post(); } catch (e) { - console.log(e); + console.error(e); self.comparadorFajaRunning = false; } } @@ -1638,13 +1638,13 @@ class Comparador { self.comparadorGuardasRunning = false; }, (error) => { - console.log(error); + console.error(error); self.comparadorGuardasRunning = false; } ).post(); } catch (e) { - console.log(e); + console.error(e); self.comparadorGuardasRunning = false; } } From 10d5c286a6d5abc0e8bf6131c818d93957aee3ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Mon, 10 Feb 2025 20:01:21 +0100 Subject: [PATCH 2/2] =?UTF-8?q?a=C3=B1adido=20calcular=20mermas=20en=20el?= =?UTF-8?q?=20draw=20de=20la=20slineas=20presupuesto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presupuestoAdmin/presupuestoAdminEdit.js | 1 + .../pages/presupuestoAdmin/sections/datosLibro.js | 15 ++++++++------- .../sections/lineasPresupuesto.js | 6 +++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js index 7bf223b2..21fd9fb6 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/presupuestoAdminEdit.js @@ -47,6 +47,7 @@ class PresupuestoAdminEdit { this.lineasPresupuesto = new LineasPresupuesto(this.domItem.find('#accordionLineasPresupuestoTip'), { getDimensionLibro: this.getDimensionLibro, + calcular_mermas: this.datosLibro.calcular_mermas, }); this.previewFormasAdmin = null; diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js index e4eec8df..bc3bb481 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/datosLibro.js @@ -531,17 +531,18 @@ class DatosLibro { } else { let merma_lineas = [] - $('#tableLineasPresupuesto').DataTable().rows().every(function (rowIdx, tableLoop, rowLoop) { - var rowData = this.data(); + const table = $('#tableLineasPresupuesto').DataTable(); + const rows = table.rows().data(); + for (let i = 0; i < rows.length; i++) { + const rowData = rows[i]; if (rowData.row_id != 'lp_guardas' && rowData.row_id != 'lp_cubierta' && rowData.row_id != 'lp_sobrecubierta') { - const formas_linea = parseInt($('#isCosido').val()) == 0 ? parseInt(rowData.formas) : parseInt(rowData.formas) / 2 + const formas_linea = parseInt($('#isCosido').val()) == 0 ? parseInt(rowData.formas) : parseInt(rowData.formas) / 2; if (formas_linea > tirada) - merma_lineas.push(formas_linea - tirada) + merma_lineas.push(formas_linea - tirada); else - merma_lineas.push(tirada % formas_linea) + merma_lineas.push(tirada % formas_linea); } - - }) + } if (merma_lineas.length > 0) diff --git a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js index 47425ccb..b67e0674 100644 --- a/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js +++ b/httpdocs/assets/js/safekat/pages/presupuestoAdmin/sections/lineasPresupuesto.js @@ -9,6 +9,7 @@ class LineasPresupuesto { constructor(domItem, functions = {}) { this.domItem = domItem; this.getDimensionLibro = functions.getDimensionLibro; + this.calcular_mermas = functions.calcular_mermas; this.table = null; @@ -1681,9 +1682,8 @@ class LineasPresupuesto { $('#' + linea + '_checkPapel').trigger('change'); - /* TO-DO - calcular_mermas() - */ + this.calcular_mermas() + $(document).trigger('update-presupuesto', { update_lineas: false,