From 19e3e6ce0e68b574525f7bd034c3acbc4a1c2393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Jim=C3=A9nez?= Date: Thu, 19 Sep 2024 09:13:25 +0200 Subject: [PATCH] cambiado el margen de servicios para que coincida con las tarifas. Las horas se meten como margen impresion --- .../cosidotapablanda/_resumenPresupuestos.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js b/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js index 5c74d4d5..fac7d831 100644 --- a/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js +++ b/ci4/app/Views/themes/vuexy/form/presupuestos/cosidotapablanda/_resumenPresupuestos.js @@ -16,7 +16,11 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){ var sumForFactor = 0.0 var sumForFactorPonderado = 0.0 + + var margenPorHoras = 0.0; + if(updateLP){ + if(typeof $("#tableLineasPresupuesto").DataTable() !== 'undefined'){ $("#tableLineasPresupuesto").DataTable().rows().every( function ( rowIdx, tableLoop, rowLoop ) { var rowData = this.data(); @@ -30,7 +34,8 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){ } if(rowData.check_impresion_total){ - totalImpresion += parseFloat($('#' + rowData.row_id + '_precioImpresion').val()) + //totalImpresion += parseFloat($('#' + rowData.row_id + '_precioImpresion').val()) + margenPorHoras += parseFloat($('#' + rowData.row_id + '_precioImpresion').val()) totalImpresion += parseFloat($('#' + rowData.row_id + '_totalClicks').val()) sumForFactor += parseFloat($('#' + rowData.row_id + '_totalClicks').val()) @@ -41,8 +46,10 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){ sumForFactor += (parseFloat(rowData.totalTinta) + parseFloat(rowData.totalCorte)) } - margenImpresion += parseFloat($('#' + rowData.row_id + '_margenImpresion').val()) + //margenImpresion += parseFloat($('#' + rowData.row_id + '_margenImpresion').val()) + margenPorHoras += parseFloat($('#' + rowData.row_id + '_margenImpresion').val()) margenImpresion += parseFloat($('#' + rowData.row_id + '_margenClicks').val()) + sumForFactor -= parseFloat($('#' + rowData.row_id + '_margenClicks').val()) @@ -56,6 +63,8 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){ totalImpresion -= margenImpresion totalPapel -= margenPapel + + margenImpresion += margenPorHoras var porcentajeMargenPapel = isNaN(margenPapel/(totalPapel)*100.0)?0:margenPapel/(totalPapel)*100.0 $('#porcentajeMargenPapel').text(porcentajeMargenPapel.toFixed(0) + '%') @@ -150,7 +159,7 @@ function updateTotales(updateLP=true, updateServicios=true, updateEnvio=true){ sumForFactorPonderado += totalServicios; - var porcentajeMargenServicios = margenServicios/(margenServicios+totalServicios)*100 + var porcentajeMargenServicios = margenServicios/(totalServicios)*100 $('#porcentajeMargenServicios').text(isNaN(porcentajeMargenServicios.toFixed(0))?0:porcentajeMargenServicios.toFixed(0) + '%') $('#totalServicios').text((addSeparatorsNF(totalServicios.toFixed(2), ".", ",", ".")) + "€") $('#margenServicios').text((addSeparatorsNF(margenServicios.toFixed(2), ".", ",", ".")) + "€")