diff --git a/ci4/app/Entities/Presupuestos/PresupuestoEntity.php b/ci4/app/Entities/Presupuestos/PresupuestoEntity.php index 4780b61f..f4a7d2d3 100755 --- a/ci4/app/Entities/Presupuestos/PresupuestoEntity.php +++ b/ci4/app/Entities/Presupuestos/PresupuestoEntity.php @@ -134,29 +134,13 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity "lomo" => null, "isDig" => false, "total_presupuesto" => null, - "total_pedido" => null, - "total_peso" => null, - "total_click" => null, - "total_preimpresion" => null, - "total_preimpresion_margen" => null, - "total_manipulado" => null, - "total_acabado" => null, - "total_envios" => null, "envios_recoge_cliente" => false, "margen" => null, "margen_extra" => 0.0, "margen_manual" => null, "descuento" => 0.0, "base_imponible" => null, - "total_margen" => null, - "total_margen_extra" => null, - "total_descuento" => null, - "total" => null, "forzar_total" => 0, - "total_calculado" => null, - "total_confirmado" => null, - "total_confirmado_user_id" => null, - "total_confirmado_update_at" => null, "tirada_alternativa_json_data" => null, "aprobado_user_id" => null, "aprobado_at" => null, @@ -177,6 +161,23 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity "updated_at" => null, "comp_tipo_impresion" => null, "comp_pos_paginas_color" => null, + "total_coste_papel" => null, + "total_margen_papel" => null, + "total_margenPercent_papel" => null, + "total_coste_impresion" => null, + "total_margen_impresion" => null, + "total_margenPercent_impresion" => null, + "total_coste_servicios" => null, + "total_margen_servicios" => null, + "total_margenPercent_servicios" => null, + "total_coste_envios" => null, + "total_margen_envios" => null, + "total_costes" => null, + "total_margenes" => null, + "total_antes_descuento" => null, + "total_descuento" => null, + "total_presupuesto" => null, + "total_precio_unidad" => null, ]; protected $casts = [ "version" => "int", @@ -291,31 +292,33 @@ class PresupuestoEntity extends \CodeIgniter\Entity\Entity "lomo" => "?int", "isDig" => "boolean", "total_presupuesto" => "?float", - "total_pedido" => "?float", - "total_peso" => "?float", - "total_click" => "?float", - "total_preimpresion" => "?float", - "total_preimpresion_margen" => "?float", - "total_manipulado" => "?float", - "total_acabado" => "?float", - "total_envios" => "?float", "envios_recoge_cliente" => "boolean", "margen" => "?float", "margen_extra" => "float", "margen_manual" => "?float", "descuento" => "float", "base_imponible" => "?float", - "total_margen" => "?float", - "total_margen_extra" => "?float", - "total_descuento" => "?float", - "total" => "?float", "forzar_total" => "float", - "total_calculado" => "?float", - "total_confirmado" => "?float", - "total_confirmado_user_id" => "?int", "aprobado_user_id" => "?int", "fecha_entrega_real_aviso" => "?boolean", "pedido_espera_user_id" => "?int", "is_deleted" => "int", + "total_coste_papel" => "?float", + "total_margen_papel" => "?float", + "total_margenPercent_papel" => "?float", + "total_coste_impresion" => "?float", + "total_margen_impresion" => "?float", + "total_margenPercent_impresion" => "?float", + "total_coste_servicios" => "?float", + "total_margen_servicios" => "?float", + "total_margenPercent_servicios" => "?float", + "total_coste_envios" => "?float", + "total_margen_envios" => "?float", + "total_costes" => "?float", + "total_margenes" => "?float", + "total_antes_descuento" => "?float", + "total_descuento" => "?float", + "total_presupuesto" => "?float", + "total_precio_unidad" => "?float", ]; } diff --git a/ci4/app/Models/Presupuestos/PresupuestoModel.php b/ci4/app/Models/Presupuestos/PresupuestoModel.php index 8c2916fb..d263785f 100755 --- a/ci4/app/Models/Presupuestos/PresupuestoModel.php +++ b/ci4/app/Models/Presupuestos/PresupuestoModel.php @@ -154,29 +154,13 @@ class PresupuestoModel extends \App\Models\GoBaseModel "lomo", "isDig", "total_presupuesto", - "total_pedido", - "total_peso", - "total_click", - "total_preimpresion", - "total_preimpresion_margen", - "total_manipulado", - "total_acabado", - "total_envios", "envios_recoge_cliente", "margen", "margen_extra", "margen_manual", "descuento", "base_imponible", - "total_margen", - "total_margen_extra", - "total_descuento", - "total", "forzar_total", - "total_calculado", - "total_confirmado", - "total_confirmado_user_id", - "total_confirmado_update_at", "tirada_alternativa_json_data", "aprobado_user_id", "aprobado_at", @@ -194,6 +178,23 @@ class PresupuestoModel extends \App\Models\GoBaseModel "is_deleted", "comp_tipo_impresion", "comp_pos_paginas_color", + "total_coste_papel", + "total_margen_papel", + "total_margenPercent_papel", + "total_coste_impresion", + "total_margen_impresion", + "total_margenPercent_impresion", + "total_coste_servicios", + "total_margen_servicios", + "total_margenPercent_servicios", + "total_coste_envios", + "total_margen_envios", + "total_costes", + "total_margenes", + "total_antes_descuento", + "total_descuento", + "total_presupuesto", + "total_precio_unidad", ]; protected $returnType = "App\Entities\Presupuestos\PresupuestoEntity"; 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 81885369..1595b10f 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 @@ -319,7 +319,6 @@ function load_datos_envios(){ 'actionBtns_direcciones': actionBtns_direcciones, }) .draw(); - updateTotales() checkInsertar() }); }) @@ -327,6 +326,4 @@ function load_datos_envios(){ -load_datos_envios() - endSection() ?> \ 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 8398dfce..436fae78 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 @@ -513,7 +513,7 @@ url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/i18n ?>.json" }, "drawCallback": function(settings ) { - updateTotales() + updateTotales(false, true, false) } }); @@ -720,7 +720,7 @@ url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/i18n ?>.json" }, "drawCallback": function(settings ) { - updateTotales() + updateTotales(false, true, false) } }); @@ -1028,7 +1028,7 @@ url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/i18n ?>.json" }, "drawCallback": function(settings ) { - updateTotales() + updateTotales(false, true, false) } }); @@ -1199,7 +1199,7 @@ url: "//cdn.datatables.net/plug-ins/1.13.4/i18n/i18n ?>.json" }, "drawCallback": function(settings ) { - updateTotales() + updateTotales(false, true, false) } }); 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 740c41d7..60c50cf3 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 @@ -555,7 +555,7 @@ $(document).on('click', '.btn-delete-lp', function(e) { tableLineasPresupuesto.row( row ) .remove() .draw(); - updateTotales() + updateTotales(true, false, false) }) @@ -1240,7 +1240,6 @@ function por_defecto_lp_bn(){ function fill_lp_bn(row, fromComparator=false){ - console.log(row) if(fromComparator){ var input_data = { @@ -1268,7 +1267,7 @@ function fill_lp_bn(row, fromComparator=false){ eventos_lp_bn(data.maquinaTipo=='inkjet'?true:false) calcular_mermas() - updateTotales() + updateTotales(true, false, false) } $("#tableLineasPresupuesto").DataTable().columns.adjust(); @@ -1550,7 +1549,7 @@ function fill_lp_color(row, fromComparator=false){ eventos_lp_color(data.maquinaTipo=='inkjet'?true:false) calcular_mermas() - updateTotales() + updateTotales(true, false, false) } $("#tableLineasPresupuesto").DataTable().columns.adjust(); @@ -1835,7 +1834,7 @@ function fill_lp_bnhq(row, fromComparator=false){ eventos_lp_bnhq(data.maquinaTipo=='inkjet'?true:false) calcular_mermas() - updateTotales() + updateTotales(true, false, false) } $("#tableLineasPresupuesto").DataTable().columns.adjust(); @@ -2120,7 +2119,7 @@ function fill_lp_colorhq(row, fromComparator=false){ eventos_lp_colorhq(data.maquinaTipo=='inkjet'?true:false) calcular_mermas() - updateTotales() + updateTotales(true, false, false) } $("#tableLineasPresupuesto").DataTable().columns.adjust(); @@ -2438,7 +2437,7 @@ function fill_lp_rot_bn(row, fromComparador=false){ eventos_lp_rot_bn() calcular_mermas() - updateTotales() + updateTotales(true, false, false) } $('.lp_rot_bn').css('display', '') @@ -2759,7 +2758,7 @@ function fill_lp_rot_color(row, fromComparador=false){ eventos_lp_rot_color() calcular_mermas() - updateTotales() + updateTotales(true, false, false) } $("#tableLineasPresupuesto").DataTable().columns.adjust(); @@ -3022,7 +3021,7 @@ function fill_lp_cubierta(row, fromComparador=false){ eventos_lp_cubierta() calcular_mermas() - updateTotales() + updateTotales(true, false, false) } 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 e8d0c998..8681598b 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 @@ -163,10 +163,9 @@ $('#saveDireccionEnvio').on('click', function(){ } var peso_total_libro = 0 - $('#tableLineasPresupuesto tbody tr:visible ').each(function(){ - // No se incluyen las lineas de datos de rotativa - if(!this.id.includes("_data") ) - peso_total_libro += parseFloat($('#' + this.id + '_peso').val()) + tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) { + var rowData = this.data(); + peso_total_libro += rowData.peso }) const peso_envio = peso_total_libro*parseInt($('#add_cantidad').val())/1000.0 @@ -249,6 +248,7 @@ $('#saveDireccionEnvio').on('click', function(){ }) } checkInsertar() + updateTotales(false, false, 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 94c8353e..c45e2754 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 @@ -19,34 +19,34 @@
Detalles del presupuesto
Coste papel
-
NaN €
+
total_coste_papel) ?>€
Margen papel
-
NaN €
-
NaN €
+
total_margenPercent_papel) ?>%
+
total_margen_papel) ?>€
Coste impresión
-
NaN €
+
total_coste_impresion) ?>€
Margen impresión
-
-
NaN €
+
total_margenPercent_impresion) ?>%
+
total_margen_impresion) ?>€
Coste servicios
-
NaN €
+
total_coste_servicios) ?>€
Margen servicios
-
NaN €
-
NaN €
+
total_margenPercent_servicios) ?>%
+
total_margen_servicios) ?>€
Coste de envío
-
NaN€
+
total_coste_envios) ?>€
Margen envío
-
NaN €
+
total_margen_envios) ?>€

Total Costes
-
NaN €
+
total_costes) ?>€
Total Margen
-
NaN €
+
total_margenes) ?>€
@@ -54,14 +54,14 @@
Total
-
NaN €
+
total_antes_descuento) ?>€
Descuento
-
-
NaN €
+
+
total_descuento) ?>€
Total presupuesto
-
NaN €
+
total_presupuesto) ?>€
Precio unidad
-
NaN €
+
total_precio_unidad) ?>€
@@ -82,99 +82,114 @@ section("additionalInlineJs") ?> -updateTotales() -function updateTotales(){ + +function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){ totalPapel = 0 margenPapel = 0 totalImpresion = 0 + margenImpresion = 0 totalServicios = 0 margenServicios = 0 - $('#tableLineasPresupuesto tbody tr:visible ').each(function(){ - if($('#' + this.id + '_checkPapel').prop('checked')){ - totalPapel += parseFloat($('#' + this.id + '_totalPapelPedido').val()) - margenPapel += parseFloat($('#' + this.id + '_margenPapelPedido').val()) + if(updateLP){ + if(typeof tableLineasPresupuesto !== 'undefined'){ + tableLineasPresupuesto.rows().every( function ( rowIdx, tableLoop, rowLoop ) { + var rowData = this.data(); + if($('#' + rowData.row_id + '_checkPapel').prop('checked')){ + totalPapel += parseFloat($('#' + rowData.row_id + '_totalPapelPedido').val()) + margenPapel += parseFloat($('#' + rowData.row_id + '_margenPapelPedido').val()) + } + if($('#' + rowData.row_id + '_checkClicks').prop('checked')){ + totalImpresion += parseFloat($('#' + rowData.row_id + '_precioImpresion').val()) + margenImpresion += parseFloat($('#' + rowData.row_id + '_margenImpresion').val()) + if(!isNaN(parseFloat($('#' + rowData.row_id + 'lp_bn_totalTinta').val()))) + totalImpresion += parseFloat($('#' + rowData.row_id + 'lp_bn_totalTinta').val()) + } + }) } - if($('#' + this.id + '_checkClicks').prop('checked')){ - totalImpresion += parseFloat($('#' + this.id + '_totalClicks').val()) + + var porcentajeMargenPapel = isNaN(margenPapel/(totalPapel)*100)?0:margenPapel/(totalPapel)*100 + $('#porcentajeMargenPapel').text(porcentajeMargenPapel.toFixed(0) + '%') + $('#totalCostePapel').text(totalPapel.toFixed(2)+ '€') + $('#margenPapel').text(margenPapel.toFixed(2) + '€') + + var porcentajeMargenImpresion = isNaN(margenImpresion/(totalImpresion)*100)?0:margenImpresion/(totalImpresion)*100 + $('#porcentajeMargenImpresion').text(porcentajeMargenImpresion.toFixed(0) + '%') + $('#totalCosteImpresion').text(totalImpresion.toFixed(2) + '€') + $('#margenImpresion').text(margenImpresion.toFixed(2) + '€') + } + + if(updateServicios){ + + if ( typeof tableServiciosEnc !== 'undefined' && tableServiciosEnc.rows().count() > 0){ + $('#tableOfServiciosEncuadernacion tbody tr').each(function(){ + var currentRow = $(this).closest("tr"); + var subId = $('#tableOfServiciosEncuadernacion').DataTable().cell(currentRow,0).node().innerHTML; + var total = parseFloat($('#precio_total_encuadernado_' + subId)[0].value) + totalServicios += total + margenServicios += (total*parseFloat($('#enc_margen_' + subId)[0].innerHTML)/100.0) + }) } - }) - - var porcentajeMargenPapel = margenPapel/(totalPapel)*100 - $('#porcentajeMargenPapel').text(porcentajeMargenPapel.toFixed(0) + '%') - $('#totalCostePapel').text(totalPapel.toFixed(2) + '€') - $('#margenPapel').text(margenPapel.toFixed(2) + '€') - - margenImpresion = totalImpresion*$('#margenImpresionValue').val()/100.0 - $('#totalCosteImpresion').text(totalImpresion.toFixed(2) + '€') - $('#margenImpresion').text((totalImpresion*$('#margenImpresionValue').val()/100.0).toFixed(2) + '€') - if ( typeof tableServiciosEnc !== 'undefined' && tableServiciosEnc.rows().count() > 0){ - $('#tableOfServiciosEncuadernacion tbody tr').each(function(){ - var currentRow = $(this).closest("tr"); - var subId = $('#tableOfServiciosEncuadernacion').DataTable().cell(currentRow,0).node().innerHTML; - var total = parseFloat($('#precio_total_encuadernado_' + subId)[0].value) - totalServicios += total - margenServicios += (total*parseFloat($('#enc_margen_' + subId)[0].innerHTML)/100.0) - }) + if ( typeof tableServiciosAcabado !== 'undefined' && tableServiciosAcabado.rows().count() > 0){ + $('#tableOfServiciosAcabado tbody tr').each(function(){ + var currentRow = $(this).closest("tr"); + var subId = $('#tableOfServiciosAcabado').DataTable().cell(currentRow,0).node().innerHTML; + var total = parseFloat($('#precio_total_acabado_' + subId)[0].value) + totalServicios += total + margenServicios += (total*parseFloat($('#acabado_margen_' + subId)[0].innerHTML)/100.0) + }) + } + + if ( typeof tableServiciosPreimpresion !== 'undefined' && tableServiciosPreimpresion.rows().count() > 0){ + + $('#tableOfServiciosPreimpresion tbody tr').each(function(){ + var currentRow = $(this).closest("tr"); + var subId = $('#tableOfServiciosPreimpresion').DataTable().cell(currentRow,0).node().innerHTML; + var total = parseFloat($('#precio_preimpresion_' + subId)[0].value) + totalServicios += total + margenServicios += (total*parseFloat($('#preimpresion_margen_' + subId)[0].innerHTML)/100.0) + }) + } + + if ( typeof tableServiciosManipulado !== 'undefined' && tableServiciosManipulado.rows().count() > 0){ + + $('#tableOfServiciosManipulado tbody tr').each(function(){ + var currentRow = $(this).closest("tr"); + var subId = $('#tableOfServiciosManipulado').DataTable().cell(currentRow,0).node().innerHTML; + var total = parseFloat($('#precio_total_manipulado_' + subId)[0].value) + totalServicios += total + margenServicios += (total*parseFloat($('#manipulado_margen_' + subId)[0].innerHTML)/100.0) + }) + } + + totalServicios -= margenServicios; + var porcentajeMargenServicios = margenServicios/(margenServicios+totalServicios)*100 + $('#porcentajeMargenServicios').text(porcentajeMargenServicios.toFixed(0) + '%') + $('#totalServicios').text(totalServicios.toFixed(2) + '€') + $('#margenServicios').text(margenServicios.toFixed(2) + '€') } - if ( typeof tableServiciosAcabado !== 'undefined' && tableServiciosAcabado.rows().count() > 0){ - $('#tableOfServiciosAcabado tbody tr').each(function(){ - var currentRow = $(this).closest("tr"); - var subId = $('#tableOfServiciosAcabado').DataTable().cell(currentRow,0).node().innerHTML; - var total = parseFloat($('#precio_total_acabado_' + subId)[0].value) - totalServicios += total - margenServicios += (total*parseFloat($('#acabado_margen_' + subId)[0].innerHTML)/100.0) - }) - } - - if ( typeof tableServiciosPreimpresion !== 'undefined' && tableServiciosPreimpresion.rows().count() > 0){ - - $('#tableOfServiciosPreimpresion tbody tr').each(function(){ - var currentRow = $(this).closest("tr"); - var subId = $('#tableOfServiciosPreimpresion').DataTable().cell(currentRow,0).node().innerHTML; - var total = parseFloat($('#precio_preimpresion_' + subId)[0].value) - totalServicios += total - margenServicios += (total*parseFloat($('#preimpresion_margen_' + subId)[0].innerHTML)/100.0) - }) + if(updateEnvio){ + + var totalEnvios = 0 + var margenEnvios = 0 + if ( typeof tableEnvios !== 'undefined' && tableEnvios.rows().count() > 0){ + tableEnvios.rows().every( function ( rowIdx, tableLoop, rowLoop ) { + var data = this.data() + totalEnvios += parseFloat(data.precio) + margenEnvios += parseFloat((data.precio)*data.margen/100) + } ); + } + + totalEnvios -= margenEnvios + $('#totalEnvios').text(totalEnvios.toFixed(2) + '€') + $('#margenEnvios').text(margenEnvios.toFixed(2) + '€') } - if ( typeof tableServiciosManipulado !== 'undefined' && tableServiciosManipulado.rows().count() > 0){ - - $('#tableOfServiciosManipulado tbody tr').each(function(){ - var currentRow = $(this).closest("tr"); - var subId = $('#tableOfServiciosManipulado').DataTable().cell(currentRow,0).node().innerHTML; - var total = parseFloat($('#precio_total_manipulado_' + subId)[0].value) - totalServicios += total - margenServicios += (total*parseFloat($('#manipulado_margen_' + subId)[0].innerHTML)/100.0) - }) - } - - totalServicios -= margenServicios; - var porcentajeMargenServicios = margenServicios/(margenServicios+totalServicios)*100 - $('#porcentajeMargenServicios').text(porcentajeMargenServicios.toFixed(0) + '%') - $('#totalServicios').text(totalServicios.toFixed(2) + '€') - $('#margenServicios').text(margenServicios.toFixed(2) + '€') - - - var totalEnvios = 0 - var margenEnvios = 0 - if ( typeof tableEnvios !== 'undefined' && tableEnvios.rows().count() > 0){ - tableEnvios.rows().every( function ( rowIdx, tableLoop, rowLoop ) { - var data = this.data() - totalEnvios += parseFloat(data.precio) - margenEnvios += parseFloat((data.precio)*data.margen/100) - } ); - } - - totalEnvios -= margenEnvios - $('#totalEnvios').text(totalEnvios.toFixed(2) + '€') - $('#margenEnvios').text(margenEnvios.toFixed(2) + '€') - var totalCostes = totalPapel + totalImpresion + totalServicios + totalEnvios var totalMargenes = margenPapel + margenImpresion + margenServicios + margenEnvios $('#totalCostes').text((totalCostes).toFixed(2) + '€') @@ -189,11 +204,42 @@ function updateTotales(){ $('#descuentoTotal').text((totalDescuento).toFixed(2) + '€') $('#totalDespuesDecuento').text((totalPresupuesto).toFixed(2) + '€') $('#precioUnidadPresupuesto').text((precioUnidad).toFixed(2) + '€') - + } +function getValuesResumenForm(){ + var formResumen = "" + formResumen += '&total_coste_papel=' + $('#totalCostePapel').text().replace('€', '') + formResumen += '&total_margen_papel=' + $('#margenPapel').text().replace('€', '') + formResumen += '&total_margenPercent_papel=' + $('#porcentajeMargenPapel').text().replace('%', '') + + formResumen += '&total_coste_impresion=' + $('#totalCosteImpresion').text().replace('€', '') + formResumen += '&total_margen_impresion=' + $('#margenImpresion').text().replace('€', '') + formResumen += '&total_margenPercent_impresion=' + $('#porcentajeMargenImpresion').text().replace('%', '') + + formResumen += '&total_coste_servicios=' + $('#totalServicios').text().replace('€', '') + formResumen += '&total_margen_servicios=' + $('#margenServicios').text().replace('€', '') + formResumen += '&total_margenPercent_servicios=' + $('#porcentajeMargenServicios').text().replace('%', '') + + formResumen += '&total_coste_envios=' + $('#totalEnvios').text().replace('€', '') + formResumen += '&total_margen_envios=' + $('#margenEnvios').text().replace('€', '') + + formResumen += '&total_costes=' + $('#totalCostes').text().replace('€', '') + formResumen += '&total_margenes=' + $('#totalMargenes').text().replace('€', '') + + formResumen += '&total_antes_descuento=' + $('#totalAntesDescuento').text().replace('€', '') + formResumen += '&total_descuento=' + $('#descuentoTotal').text().replace('€', '') + formResumen += '&total_presupuesto=' + $('#totalDespuesDecuento').text().replace('€', '') + formResumen += '&total_precio_unidad=' + $('#precioUnidadPresupuesto').text().replace('€', '') + + return formResumen +} + + + + $(".update-totales").on("change", function(){ - updateTotales() + updateTotales(true, true, true) }) endSection() ?> 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 74c08bc9..c0455cd0 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 @@ -135,6 +135,8 @@ $('#presupuestoForm').on( "submit", function( event ) { $.when(fill_bbdd_from_lp(id).then(function (data, textStatus, jqXHR){ generateCompJSON() form = $('#presupuestoForm').serialize() + form += getValuesResumenForm() + $.ajax({ type: "POST", url: "",