From 744dd5853cb50ea383f3aa96e4e5e22f5a10ce76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Mon, 11 Mar 2024 15:42:22 +0100 Subject: [PATCH] mejorando actualizacion de presupuesto --- .../cosidotapablanda/_datosEnvios.php | 29 +++- .../cosidotapablanda/_datosLibroItems.php | 38 +++++- .../cosidotapablanda/_datosServiciosItems.js | 125 ++++++++++-------- .../cosidotapablanda/_datosServiciosItems.php | 103 +++++++++++++-- .../_lineasPresupuestoItems.php | 114 +++++++++++----- .../_presupuestoDireccionesForm.php | 9 +- .../_resumenPresupuestoItems.php | 11 +- .../_tiradasAlternativasItems.js | 6 +- .../viewCosidotapablandaForm.php | 64 +++++++++ 9 files changed, 385 insertions(+), 114 deletions(-) diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosEnvios.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosEnvios.php index b973d9c5..8137b3d2 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosEnvios.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosEnvios.php @@ -141,7 +141,14 @@ function updateTablaEnvios(){ .draw(); checkInsertar() - updateTotales(false, false, true) + //updateTotales(false, false, true) + updatePresupuesto({ + update_lineas: false, + update_servicios: false, + update_envios: false, + update_resumen: true, + update_tiradas_alternativas: true + }) } else{ popErrorAlert('', 'error-tarifa') @@ -155,7 +162,14 @@ $(document).on('click', '.delete-add-row', function(e) { .remove() .draw(); checkInsertar() - updateTotales(false, false, true) + //updateTotales(false, false, true) + updatePresupuesto({ + update_lineas: false, + update_servicios: false, + update_envios: false, + update_resumen: true, + update_tiradas_alternativas: true + }) }) @@ -382,9 +396,16 @@ function load_datos_envios(){ }) .draw(); checkInsertar() - updateTotales(false, false, true) + //updateTotales(false, false, true) + updatePresupuesto({ + update_lineas: false, + update_servicios: false, + update_envios: false, + update_resumen: true, + update_tiradas_alternativas: false + }) }); - $('#tableOfDireccionesEnvio').bind('draw.dt', update_tiradas_alternativas); + //$('#tableOfDireccionesEnvio').bind('draw.dt', update_tiradas_alternativas); }) } diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php index 543a1f26..f1039c7e 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosLibroItems.php @@ -335,7 +335,7 @@ $('#paginas').on("change", function () { if(url_parts2[url_parts2.length-2] == 'edit'){ checkPaginasPresupuesto() - updateLineasPresupuesto() + // Si es negro o color if ($('#tipoImpresion').select2('data')[0].id == 'negro' || $('#tipoImpresion').select2('data')[0].id == 'color') { @@ -349,7 +349,15 @@ $('#paginas').on("change", function () { $('#compPaginasNegrohq').trigger('change'); } - update_servicios(false) + //update_servicios(false) + //updateLineasPresupuesto() + updatePresupuesto({ + update_lineas: true, + update_servicios: true, + update_envios: true, + update_resumen: true, + update_tiradas_alternativas: true + }) } }); @@ -369,8 +377,15 @@ $('#tirada').on("change", function () { const url_parts2 = url2.split('/'); if(url_parts2[url_parts2.length-2] == 'edit'){ - update_servicios(false) - updateLineasPresupuesto() + //update_servicios(false) + //updateLineasPresupuesto() + updatePresupuesto({ + update_lineas: true, + update_servicios: true, + update_envios: true, + update_resumen: true, + update_tiradas_alternativas: false + }) checkInsertar() } }) @@ -493,8 +508,7 @@ function event_change_formato(){ ancho_libro = getDimensionLibro().ancho; alto_libro = getDimensionLibro().alto; - checkPaginasPresupuesto() - updateLineasPresupuesto() + // Si es negro o color if ($('#tipoImpresion').select2('data')[0].id == 'negro' || $('#tipoImpresion').select2('data')[0].id == 'color') { @@ -509,7 +523,17 @@ function event_change_formato(){ $('#compPapelCubierta').trigger('change'); $('#compPapelSobrecubierta').trigger('change'); - update_servicios(false) + checkPaginasPresupuesto() + + updatePresupuesto({ + update_lineas: true, + update_servicios: true, + update_envios: true, + update_resumen: true, + update_tiradas_alternativas: true + }) + //updateLineasPresupuesto() + //update_servicios(false) } diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.js b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.js index f70e6d8b..208117c0 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.js +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.js @@ -52,22 +52,25 @@ async function get_servAcabados_tiradasAlternativas(tirada){ tirada: parseInt(tirada), POD: $('#POD').val() } - json_data = Object.assign(json_data, window.token_ajax); + if(json_data.datos.length>0){ + + json_data = Object.assign(json_data, window.token_ajax); - const response = await fetch(window.location.origin + "/presupuestos/presupuestoacabados/update/" + id , { - method: "POST", - body: JSON.stringify(json_data), - headers: { - "Content-type": "application/json; charset=UTF-8" - } - }) - const values = await response.json(); - yeniden(values[window.csrf_token]); - values.lines.forEach((line) => { - - serviciosAcabados.coste += parseFloat(line[0].total); - serviciosAcabados.margen += parseFloat(line[0].total)*parseFloat(line[0].margen)/100.0; - }); + const response = await fetch(window.location.origin + "/presupuestos/presupuestoacabados/update/" + id , { + method: "POST", + body: JSON.stringify(json_data), + headers: { + "Content-type": "application/json; charset=UTF-8" + } + }) + const values = await response.json(); + yeniden(values[window.csrf_token]); + values.lines.forEach((line) => { + + serviciosAcabados.coste += parseFloat(line[0].total); + serviciosAcabados.margen += parseFloat(line[0].total)*parseFloat(line[0].margen)/100.0; + }); + } return serviciosAcabados; } @@ -123,21 +126,24 @@ async function get_servEncuadernacion_tiradasAlternativas(tirada, paginas, ancho alto: alto, POD: $('#POD').val() } - json_data = Object.assign(json_data, window.token_ajax); - const response = await fetch(window.location.origin + "/presupuestos/presupuestoencuadernaciones/update/" + id , { - method: "POST", - body: JSON.stringify(json_data), - headers: { - "Content-type": "application/json; charset=UTF-8" - } - }) - const values = await response.json(); - yeniden(values[window.csrf_token]); - values.lines.forEach((line) => { - serviciosEncuadernacion.coste += parseFloat(line[0].total); - serviciosEncuadernacion.margen += parseFloat(line[0].total)*parseFloat(line[0].margen)/100.0; - }); + if(json_data.datos.length>0){ + json_data = Object.assign(json_data, window.token_ajax); + + const response = await fetch(window.location.origin + "/presupuestos/presupuestoencuadernaciones/update/" + id , { + method: "POST", + body: JSON.stringify(json_data), + headers: { + "Content-type": "application/json; charset=UTF-8" + } + }) + const values = await response.json(); + yeniden(values[window.csrf_token]); + values.lines.forEach((line) => { + serviciosEncuadernacion.coste += parseFloat(line[0].total); + serviciosEncuadernacion.margen += parseFloat(line[0].total)*parseFloat(line[0].margen)/100.0; + }); + } return serviciosEncuadernacion; } @@ -188,21 +194,23 @@ async function get_servManipulado_tiradasAlternativas(tirada){ tirada: parseInt(tirada), POD: $('#POD').val() } - json_data = Object.assign(json_data, window.token_ajax); + if(json_data.datos.length>0){ + json_data = Object.assign(json_data, window.token_ajax); - const response = await fetch(window.location.origin + "/presupuestos/presupuestomanipulados/update/" + id , { - method: "POST", - body: JSON.stringify(json_data), - headers: { - "Content-type": "application/json; charset=UTF-8" - } - }) - const values = await response.json(); - yeniden(values[window.csrf_token]); - values.lines.forEach((line) => { - serviciosManipulado.coste += parseFloat(line[0].total); - serviciosManipulado.margen += parseFloat(line[0].total)*parseFloat(line[0].margen)/100.0; - }); + const response = await fetch(window.location.origin + "/presupuestos/presupuestomanipulados/update/" + id , { + method: "POST", + body: JSON.stringify(json_data), + headers: { + "Content-type": "application/json; charset=UTF-8" + } + }) + const values = await response.json(); + yeniden(values[window.csrf_token]); + values.lines.forEach((line) => { + serviciosManipulado.coste += parseFloat(line[0].total); + serviciosManipulado.margen += parseFloat(line[0].total)*parseFloat(line[0].margen)/100.0; + }); + } return serviciosManipulado; } @@ -247,20 +255,23 @@ async function get_servPreimpresion_tiradasAlternativas(){ datos: get_datos_preimpresion(), POD: $('#POD').val() } - json_data = Object.assign(json_data, window.token_ajax); + if(json_data.datos.length>0){ - const response = await fetch(window.location.origin + "/presupuestos/presupuestopreimpresiones/update/" + id , { - method: "POST", - body: JSON.stringify(json_data), - headers: { - "Content-type": "application/json; charset=UTF-8" - } - }) - const values = await response.json(); - yeniden(values[window.csrf_token]); - values.lines.forEach((line) => { - serviciosPreimpresion.coste += parseFloat(line[0].precio); - serviciosPreimpresion.margen += parseFloat(line[0].precio)*parseFloat(line[0].margen)/100.0; - }); + json_data = Object.assign(json_data, window.token_ajax); + + const response = await fetch(window.location.origin + "/presupuestos/presupuestopreimpresiones/update/" + id , { + method: "POST", + body: JSON.stringify(json_data), + headers: { + "Content-type": "application/json; charset=UTF-8" + } + }) + const values = await response.json(); + yeniden(values[window.csrf_token]); + values.lines.forEach((line) => { + serviciosPreimpresion.coste += parseFloat(line[0].precio); + serviciosPreimpresion.margen += parseFloat(line[0].precio)*parseFloat(line[0].margen)/100.0; + }); + } return serviciosPreimpresion; } \ No newline at end of file diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php index dbc84863..5876de3f 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_datosServiciosItems.php @@ -298,6 +298,14 @@ check_serv_acabado_error() check_serv_preimpresion_error() check_serv_manipulado_error() + updatePresupuesto({ + update_lineas: false, + update_servicios: false, + update_envios: false, + update_resumen: true, + update_tiradas_alternativas: true + }) + //updateTotales(false, true, false) }); @@ -374,7 +382,8 @@ ) } - function update_servicios(update_preimpresion=false){ + function actualizar_servicios(update_preimpresion=false){ + const domain = window.location.origin const dimension = getDimensionLibro(); @@ -448,6 +457,7 @@ $('#proveedor_enc_' + line[0].tarifa_id).on('change', proveedor_enc_event) }); check_serv_enc_error() + //updateTotales(false, true, false) yeniden(data.); }).then( fetch(domain + "/presupuestos/presupuestomanipulados/update/" + id , { @@ -470,6 +480,7 @@ $('#manipulado_margen_' + line[0].tarifa_id).val(parseFloat(line[0].margen).toFixed(2)) }); check_serv_manipulado_error() + //updateTotales(false, true, false) yeniden(data.); }).then(function(){ if(update_preimpresion){ @@ -492,6 +503,7 @@ }); check_serv_preimpresion_error() yeniden(data.); + //updateTotales(false, true, false) }) } }) @@ -521,9 +533,9 @@ language: { url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json" }, - "drawCallback": function(settings ) { + /*"drawCallback": function(settings ) { updateTotales(false, true, false) - } + }*/ }); @@ -553,6 +565,15 @@ '', '' ]).draw(false) + + //updateTotales(false, true, false) + updatePresupuesto({ + update_lineas: false, + update_servicios: false, + update_envios: false, + update_resumen: true, + update_tiradas_alternativas: false + }) }) check_serv_acabado_error() @@ -616,6 +637,16 @@ '' ]).draw(false) }); + if(data.values.lenght > 0){ + //updateTotales(false, true, false) + updatePresupuesto({ + update_lineas: false, + update_servicios: false, + update_envios: false, + update_resumen: true, + update_tiradas_alternativas: false + }) + } check_serv_acabado_error() yeniden(data.); @@ -732,9 +763,9 @@ language: { url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json" }, - "drawCallback": function(settings ) { + /*"drawCallback": function(settings ) { updateTotales(false, true, false) - } + }*/ }); @@ -806,6 +837,14 @@ $('#proveedor_enc_' + element.tarifa_encuadernado_id).on('change', proveedor_enc_event) }); + //updateTotales(false, true, false) + updatePresupuesto({ + update_lineas: false, + update_servicios: false, + update_envios: false, + update_resumen: true, + update_tiradas_alternativas: false + }) check_serv_enc_error() } @@ -839,6 +878,14 @@ $('#precio_unidad_encuadernado_' + datos.tarifa_encuadernacion_id).text(parseFloat(data.values[0].precio_unidad).toFixed(2)) $('#precio_total_encuadernado_' + datos.tarifa_encuadernacion_id).val(parseFloat(data.values[0].total).toFixed(2)) $('#enc_margen_' + datos.tarifa_encuadernacion_id).val(parseFloat(data.values[0].margen).toFixed(2)) + //updateTotales(false, true, false) + updatePresupuesto({ + update_lineas: false, + update_servicios: false, + update_envios: false, + update_resumen: true, + update_tiradas_alternativas: false + }) yeniden(data.); return true; }, @@ -964,6 +1011,16 @@ }); + if(data.values.lenght > 0){ + //updateTotales(false, true, false) + updatePresupuesto({ + update_lineas: false, + update_servicios: false, + update_envios: false, + update_resumen: true, + update_tiradas_alternativas: false + }) + } check_serv_enc_error() yeniden(data.); return true; @@ -1009,9 +1066,9 @@ language: { url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json" }, - "drawCallback": function(settings ) { + /*"drawCallback": function(settings ) { updateTotales(false, true, false) - } + }*/ }); @@ -1104,6 +1161,16 @@ ]).draw(false) }); + if(data.values.lenght > 0){ + //updateTotales(false, true, false) + updatePresupuesto({ + update_lineas: false, + update_servicios: false, + update_envios: false, + update_resumen: true, + update_tiradas_alternativas: false + }) + } check_serv_manipulado_error() yeniden(data.); return true; @@ -1167,9 +1234,9 @@ language: { url: "/themes/vuexy/vendor/libs/datatables-sk/plugins/i18n/es-ES.json" }, - "drawCallback": function(settings ) { + /*"drawCallback": function(settings ) { updateTotales(false, true, false) - } + }*/ }); @@ -1194,6 +1261,14 @@ ]).draw(false) }) + //updateTotales(false, true, false) + updatePresupuesto({ + update_lineas: false, + update_servicios: false, + update_envios: false, + update_resumen: true, + update_tiradas_alternativas: false + }) check_serv_preimpresion_error() } @@ -1243,6 +1318,16 @@ ]).draw(false) }); + if(data.values.lenght > 0){ + //updateTotales(false, true, false) + updatePresupuesto({ + update_lineas: false, + update_servicios: false, + update_envios: false, + update_resumen: true, + update_tiradas_alternativas: false + }) + } check_serv_preimpresion_error() yeniden(data.); return true; diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php index 3229b73a..2033ce9f 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_lineasPresupuestoItems.php @@ -1049,10 +1049,9 @@ $('.insertarLinea').on("click", function (e) { } - update_servicios().then(function(){ - update_tiradas_alternativas() - }) - + update_servicios() + + }); @@ -1562,9 +1561,16 @@ function fill_lp_bn(row, fromComparator=false){ $('#lp_bn_checkPapel').change() calcular_mermas() - updateTotales(true, false, false); - updateTablaEnvios() + //updateTotales(true, false, false); + //updateTablaEnvios() + updatePresupuesto({ + update_lineas: false, + update_servicios: true, + update_envios: true, + update_resumen: true, + update_tiradas_alternativas: true + }) // Si existe cubierta, hay que actualizar con el valor del lomo check_update_cubierta() @@ -1889,9 +1895,15 @@ function fill_lp_color(row, fromComparator=false){ $('#lp_color_checkPapel').change() calcular_mermas() - updateTotales(true, false, false); - - updateTablaEnvios() + //updateTotales(true, false, false); + //updateTablaEnvios() + updatePresupuesto({ + update_lineas: false, + update_servicios: true, + update_envios: true, + update_resumen: true, + update_tiradas_alternativas: true + }) // Si existe cubierta, hay que actualizar con el valor del lomo check_update_cubierta() @@ -2214,9 +2226,15 @@ function fill_lp_bnhq(row, fromComparator=false){ $('#lp_bnhq_checkPapel').change() calcular_mermas() - updateTotales(true, false, false); - - updateTablaEnvios() + //updateTotales(true, false, false); + //updateTablaEnvios() + updatePresupuesto({ + update_lineas: false, + update_servicios: true, + update_envios: true, + update_resumen: true, + update_tiradas_alternativas: true + }) // Si existe cubierta, hay que actualizar con el valor del lomo check_update_cubierta() @@ -2548,9 +2566,15 @@ function fill_lp_colorhq(row, fromComparator=false){ $('#lp_colorhq_checkPapel').change() calcular_mermas() - updateTotales(true, false, false); - - updateTablaEnvios() + //updateTotales(true, false, false); + //updateTablaEnvios() + updatePresupuesto({ + update_lineas: false, + update_servicios: true, + update_envios: true, + update_resumen: true, + update_tiradas_alternativas: true + }) // Si existe cubierta, hay que actualizar con el valor del lomo check_update_cubierta() @@ -2887,9 +2911,15 @@ function fill_lp_rot_bn(row, fromComparador=false){ $('#lp_rot_bn_checkPapel').change() calcular_mermas() - updateTotales(true, false, false); - - updateTablaEnvios() + //updateTotales(true, false, false); + //updateTablaEnvios() + updatePresupuesto({ + update_lineas: false, + update_servicios: true, + update_envios: true, + update_resumen: true, + update_tiradas_alternativas: true + }) // Si existe cubierta, hay que actualizar con el valor del lomo check_update_cubierta() @@ -3230,9 +3260,15 @@ function fill_lp_rot_color(row, fromComparador=false){ $('#lp_rot_color_checkPapel').change() calcular_mermas() - updateTotales(true, false, false); - - updateTablaEnvios() + //updateTotales(true, false, false); + //updateTablaEnvios() + updatePresupuesto({ + update_lineas: false, + update_servicios: true, + update_envios: true, + update_resumen: true, + update_tiradas_alternativas: true + }) // Si existe cubierta, hay que actualizar con el valor del lomo check_update_cubierta() @@ -3507,9 +3543,15 @@ function fill_lp_cubierta(row, fromComparador=false){ check_update_sobrecubierta() calcular_mermas() - updateTotales(true, false, false); - - updateTablaEnvios() + //updateTotales(true, false, false); + //updateTablaEnvios() + updatePresupuesto({ + update_lineas: false, + update_servicios: true, + update_envios: true, + update_resumen: true, + update_tiradas_alternativas: true + }) } @@ -3769,9 +3811,15 @@ function fill_lp_sobrecubierta(row, fromComparador=false){ $('#lp_sobrecubierta_checkPapel').change() calcular_mermas() - updateTotales(true, false, false); - - updateTablaEnvios() + //updateTotales(true, false, false); + //updateTablaEnvios() + updatePresupuesto({ + update_lineas: false, + update_servicios: true, + update_envios: true, + update_resumen: true, + update_tiradas_alternativas: true + }) } @@ -3963,9 +4011,15 @@ function fill_lp_guardas(row, fromComparador=false){ $('#lp_guardas_checkPapel').change() calcular_mermas() - updateTotales(true, false, false); - - updateTablaEnvios() + //updateTotales(true, false, false); + //updateTablaEnvios() + updatePresupuesto({ + update_lineas: false, + update_servicios: true, + update_envios: true, + update_resumen: true, + update_tiradas_alternativas: true + }) // Si existe cubierta, hay que actualizar con el valor del lomo check_update_cubierta() diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_presupuestoDireccionesForm.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_presupuestoDireccionesForm.php index ee35fd5f..34bb8273 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_presupuestoDireccionesForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_presupuestoDireccionesForm.php @@ -250,7 +250,14 @@ $('#saveDireccionEnvio').on('click', function(){ }) } checkInsertar() - updateTotales(false, false, true) + //updateTotales(false, false, true) + updatePresupuesto({ + update_lineas: false, + update_servicios: true, + update_envios: false, + update_resumen: true, + update_tiradas_alternativas: true + }) $('#addressForm').modal("hide"); } diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestoItems.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestoItems.php index 32c509ad..2b9a9e4b 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestoItems.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestoItems.php @@ -235,8 +235,7 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){ $('#totalAntesDescuento').text((totalAntesDescuento).toFixed(2) + '€') $('#descuentoTotal').text((totalDescuento).toFixed(2) + '€') $('#totalDespuesDecuento').text((totalPresupuesto).toFixed(2) + '€') - $('#precioUnidadPresupuesto').text((precioUnidad).toFixed(2) + '€') - + $('#precioUnidadPresupuesto').text((precioUnidad).toFixed(2) + '€') } function getValuesResumenForm(){ @@ -272,7 +271,13 @@ function getValuesResumenForm(){ $(".update-totales").on("change", function(){ - updateTotales(true, true, true) + updatePresupuesto({ + update_lineas: false, + update_servicios: false, + update_envios: false, + update_resumen: true, + update_tiradas_alternativas: true + }) }) endSection() ?> diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_tiradasAlternativasItems.js b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_tiradasAlternativasItems.js index 2358dff4..6499c6b2 100644 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_tiradasAlternativasItems.js +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/_tiradasAlternativasItems.js @@ -23,7 +23,7 @@ var tableTiradas; initTableTiradas(); fill_tiradas_alternativas(); - $('.tiradas-alternativas').each(function() { + /*$('.tiradas-alternativas').each(function() { if ($(this).is('input')) { $(this).bind('change', update_tiradas_alternativas); } else if ($(this).is('button')) { @@ -35,12 +35,12 @@ var tableTiradas; // para los botones de borrar $(this).bind('click', update_tiradas_alternativas); } - }); + });*/ })(); -function update_tiradas_alternativas(){ +function actualizar_tiradas_alternativas(){ // se obtiene la primera columna de la tabla de tiradas const data = tableTiradas.rows().data().toArray(); // se borra la tabla de tiradas diff --git a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php index 1e354ad2..4e731b6e 100755 --- a/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php +++ b/ci4/app/Views/themes/backend/vuexy/form/presupuestos/cosidotapablanda/viewCosidotapablandaForm.php @@ -298,6 +298,70 @@ const url_parts = url.split('/'); + + + + + + section("additionalInlineJs") ?> + + function updatePresupuesto({update_lineas = false, update_servicios = false, update_envios = false,update_resumen = false, update_tiradas_alternativas = false}) { + + new Promise( + function(resolve, reject){ + if(update_lineas){ + updateLineasPresupuesto() + } + else + resolve() + } + ).then(function(){ + new Promise( + function(resolve, reject){ + if(update_servicios){ + actualizar_servicios() + } + else + resolve() + } + ) + }).then(function(){ + new Promise( + function(resolve, reject){ + if(update_envios){ + updateTablaEnvios() + } + else + resolve() + } + ) + }).then(function(){ + new Promise( + function(resolve, reject){ + if(update_resumen){ + updateTotales() + } + else + resolve() + } + ) + }).then(function(){ + new Promise( + function(resolve, reject){ + if(update_tiradas_alternativas){ + actualizar_tiradas_alternativas() + } + else + resolve() + } + ) + }) + } + + endSection() ?> + + +